Skip to content

Commit

Permalink
fix(core): lit portal rerender (#9012)
Browse files Browse the repository at this point in the history
  • Loading branch information
pengx17 committed Dec 4, 2024
1 parent b637a62 commit dddefcf
Showing 1 changed file with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,23 @@ class LitReactPortal extends LitElement {
};
}

override attributeChangedCallback(
name: string,
oldVal: string,
newVal: string
) {
super.attributeChangedCallback(name, oldVal, newVal);
if (name.toLowerCase() === 'portalid') {
listeners.forEach(l =>
l({
name: 'willUpdate',
target: this,
previousPortalId: oldVal,
})
);
}
}

// do not enable shadow root
override createRenderRoot() {
return this;
Expand All @@ -60,17 +77,6 @@ class LitReactPortal extends LitElement {
})
);
}

override willUpdate(changedProperties: any) {
super.willUpdate(changedProperties);
listeners.forEach(l =>
l({
name: 'willUpdate',
target: this,
previousPortalId: changedProperties.get('portalId'),
})
);
}
}

declare global {
Expand Down

0 comments on commit dddefcf

Please sign in to comment.