[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:
Aaron Bohy
2019-11-05 09:05:05 +01:00
committed by Géry Debongnie
parent 5731358607
commit af4f372506
3 changed files with 6 additions and 16 deletions
+1 -8
View File
@@ -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