mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
fix(core): lit portal rerender (#9012)
This commit is contained in:
@@ -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;
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user