Skip to content

Commit 61f7f8e

Browse files
committed
Reproduce renderComponent error: 'Cannot read property of undefined: reading syscall'
1 parent 4ddbf7e commit 61f7f8e

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

packages/@ember/-internals/glimmer/tests/integration/components/render-component-test.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,51 @@ moduleFor(
604604
expect: '<div data-one="">3</div><div data-two="">3</div>',
605605
});
606606
}
607+
608+
async '@test rendering multiple times to adjacent elements'() {
609+
let Child = defComponent(`Hi`, { scope: {} });
610+
let get = (id: string) => this.element.querySelector(id);
611+
let promises: Promise<unknown>[] = [];
612+
613+
function render(Comp: GlimmerishComponent, id: string, owner: Owner) {
614+
let promise = (async () => {
615+
await Promise.resolve();
616+
let element = get(`#${id}`);
617+
618+
renderComponent(Comp, {
619+
into: element!,
620+
owner,
621+
});
622+
})();
623+
624+
promises.push(promise);
625+
626+
return;
627+
}
628+
let A = defComponent('a:<Child />', { scope: { Child } });
629+
let B = defComponent('b:<Child />', { scope: { Child } });
630+
let Root = defComponent(
631+
[
632+
`<div id="a"></div><br>`,
633+
`<div id="b"></div>`,
634+
`{{render A 'a' owner}}`,
635+
`{{render B 'b' owner}}`,
636+
].join('\n'),
637+
{ scope: { render, A, B, owner: this.owner } }
638+
);
639+
640+
this.renderComponent(Root, {
641+
expect: [`<div id="a"></div><br>`, `<div id="b"></div>`, ``, ``].join('\n'),
642+
});
643+
644+
await Promise.all(promises);
645+
646+
assertHTML([`<div id="a">a:Hi</div><br>`, `<div id="b">b:Hi</div>`, ``, ``].join('\n'));
647+
648+
run(() => destroy(this));
649+
650+
assertHTML('');
651+
}
607652
}
608653
);
609654

0 commit comments

Comments
 (0)