Skip to content

Commit 235980f

Browse files
committed
Fix: ensuring we always render the latest app state
1 parent 9591369 commit 235980f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/ReactHTMLElement.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ class ReactHTMLElement extends HTMLElement {
2323

2424
private _awaitingRoot = false;
2525

26+
private _app: Renderable | undefined;
27+
2628
private getShadowRoot(): ShadowRoot {
2729
return this.shadowRoot || this.attachShadow({ mode: 'open' });
2830
}
@@ -72,8 +74,9 @@ class ReactHTMLElement extends HTMLElement {
7274
}
7375

7476
async renderRoot(app: Renderable): Promise<void> {
77+
this._app = app; // this value may change while we wait for root...
7578
const root = await this.root();
76-
root.render(app);
79+
root.render(this._app); // always render current app
7780
}
7881

7982
disconnectedCallback(): void {

0 commit comments

Comments
 (0)