[IMP] web: improve explanatory comment in owl_compatibility
after this commit, to update legacy widget from owl component, one need to override renderWidget and updateWidget instead of render and update method, this has been changed from commit https://github.com/odoo/odoo/commit/f2de55322e4d417815e6757517163dd0cff544cc but comment were still has render and update method to override, so with this commit update comments as well. task-2238551 closes odoo/odoo#54763 X-original-commit: 16713aaacbd4f4a25bed435bfa9045fab29a8c53 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
committed by
Hiral Bhavsar
parent
d8284d84bc
commit
e5ef19b730
@@ -56,18 +56,18 @@ odoo.define('web.OwlCompatibility', function () {
|
||||
* <SpecificAdapter Component="LegacyWidget" firstArg="a" secondArg="b"/>
|
||||
*
|
||||
* If the legacy widget has to be updated when props change, one must define
|
||||
* a subclass of ComponentAdapter to override 'update' and 'render'. The
|
||||
* 'update' function takes the nextProps as argument, and should update the
|
||||
* a subclass of ComponentAdapter to override 'updateWidget' and 'renderWidget'. The
|
||||
* 'updateWidget' function takes the nextProps as argument, and should update the
|
||||
* internal state of the widget (might be async, and return a Promise).
|
||||
* However, to ensure that the DOM is updated all at once, it shouldn't do
|
||||
* a re-rendering. This is the role of function 'render', which will be
|
||||
* a re-rendering. This is the role of function 'renderWidget', which will be
|
||||
* called just before patching the DOM, and which thus must be synchronous.
|
||||
* For instance:
|
||||
* class SpecificAdapter extends ComponentAdapter {
|
||||
* update(nextProps) {
|
||||
* updateWidget(nextProps) {
|
||||
* return this.widget.updateState(nextProps);
|
||||
* }
|
||||
* render() {
|
||||
* renderWidget() {
|
||||
* return this.widget.render();
|
||||
* }
|
||||
* }
|
||||
|
||||
Reference in New Issue
Block a user