Skip to content

Commit 0bf49c5

Browse files
committed
attempt 2
1 parent 5733044 commit 0bf49c5

File tree

1 file changed

+9
-1
lines changed
  • src/js/packages/@reactpy/client/src

1 file changed

+9
-1
lines changed

src/js/packages/@reactpy/client/src/vdom.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,15 @@ class ReactPyChild extends HTMLElement {
309309

310310
try {
311311
const bind = await loadImportSource(newImportSource, this._client);
312-
if (this.isConnected) {
312+
if (
313+
this.isConnected &&
314+
this.currentImportSource &&
315+
isImportSourceEqual(this.currentImportSource, newImportSource)
316+
) {
317+
const oldBinding = this.binding as ImportSourceBinding | null;
318+
if (oldBinding) {
319+
oldBinding.unmount();
320+
}
313321
this.binding = bind(this.mountPoint);
314322
if (this.binding) {
315323
this.binding.render(this._model);

0 commit comments

Comments
 (0)