mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] component: destroy not yet mounted components (2)
Following 2922cee6ea
Previous commit was not correct: used children with a cancelled
fiber (for instance, with a new currentFiber) could be destroyed.
This commit fixes the issue differently, by directly detecting
children that are not used anymore (and not mounted), and destroy
them directly (no need to wait for willStart promise to be resolved
anymore).
This commit is contained in:
committed by
Géry Debongnie
parent
28ee790b3e
commit
2e3e8cd603
@@ -257,13 +257,12 @@ describe("Context", () => {
|
||||
|
||||
test("destroyed component before being mounted is inactive", async () => {
|
||||
const testContext = new Context({ a: 123 });
|
||||
const def = makeDeferred();
|
||||
|
||||
class Child extends Component<any, any> {
|
||||
static template = xml`<span><t t-esc="contextObj.a"/></span>`;
|
||||
contextObj = useContext(testContext);
|
||||
willStart() {
|
||||
return def;
|
||||
return makeDeferred();
|
||||
}
|
||||
}
|
||||
class Parent extends Component<any, any> {
|
||||
@@ -279,8 +278,6 @@ describe("Context", () => {
|
||||
parent.state.flag = false;
|
||||
await prom;
|
||||
expect(fixture.innerHTML).toBe("<div></div>");
|
||||
def.resolve(); // must wait for willStart promise to be resolved
|
||||
await nextTick();
|
||||
// kind of whitebox...
|
||||
// we make sure we do not have any pending subscriptions to the 'update'
|
||||
// event
|
||||
|
||||
Reference in New Issue
Block a user