mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[REF] component: mount: remove renderBeforeRemount option
Re-render the component all the time before remounting it, which seems safer anyway. In the test, we had to add a nextTick to wait for the changes to be notified (before, we waited thanks to the additional call to mount). If we don't do the nextTick, mount is called, and render is called right after (before the promise returned by mount is resolved). This scenario doesn't work right now (see #441). Closes #381
This commit is contained in:
committed by
Géry Debongnie
parent
5731358607
commit
af4f372506
@@ -276,18 +276,11 @@ export class Component<T extends Env, Props extends {}> {
|
||||
*
|
||||
* Note that a component can be mounted an unmounted several times
|
||||
*/
|
||||
async mount(target: HTMLElement, renderBeforeRemount: boolean = false): Promise<void> {
|
||||
async mount(target: HTMLElement): Promise<void> {
|
||||
const __owl__ = this.__owl__;
|
||||
if (__owl__.isMounted) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
if (__owl__.vnode && !renderBeforeRemount) {
|
||||
target.appendChild(this.el!);
|
||||
if (document.body.contains(target)) {
|
||||
this.__callMounted();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!(target instanceof HTMLElement)) {
|
||||
let message = `Component '${
|
||||
this.constructor.name
|
||||
|
||||
Reference in New Issue
Block a user