Don't unmount on update. (#311)

This commit is contained in:
Etorix 2025-07-31 09:45:14 -07:00 • committed by GitHub
parent 140d112082
commit 174a1e36e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -385,11 +385,12 @@ export default definePlugin({
renderMagnifier(instance) {
try {
if (instance.props.id === ELEMENT_ID) {
if (!this.currentMagnifierElement) {
this.currentMagnifierElement = <Magnifier size={settings.store.size} zoom={settings.store.zoom} instance={instance} />;
if (!this.root) {
this.root = createRoot(this.element!);
this.root.render(this.currentMagnifierElement);
}
this.currentMagnifierElement = <Magnifier size={settings.store.size} zoom={settings.store.zoom} instance={instance} />;
this.root.render(this.currentMagnifierElement);
}
} catch (error) {
new Logger("ImageZoom").error("Failed to render magnifier:", error);
@ -397,7 +398,6 @@ export default definePlugin({
},
updateMagnifier(instance) {
this.unMountMagnifier();
this.renderMagnifier(instance);
},