Skip to content

Commit c550847

Browse files
committed
small fix for preview HMR issue
1 parent ecccad6 commit c550847

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

frontend/preview/preview.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,12 @@ function initPreview() {
165165
globalStore.set(getAtoms().fullConfigAtom, {} as FullConfigType);
166166
GlobalModel.getInstance().initialize(initOpts);
167167
loadFonts();
168-
const root = createRoot(document.getElementById("main")!);
168+
const container = document.getElementById("main")!;
169+
let root = (container as any).__reactRoot;
170+
if (!root) {
171+
root = createRoot(container);
172+
(container as any).__reactRoot = root;
173+
}
169174
root.render(<PreviewRoot />);
170175
}
171176

0 commit comments

Comments
 (0)