Skip to content

Commit c1de47d

Browse files
committed
Unmount root if already mounted
1 parent b30dac4 commit c1de47d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/render.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ export function render(children: React.ReactNode) {
1515
const handleInit = (payload: any) => {
1616
const { props, drawingSurface: canvas, width, top, left, height, pixelRatio } = payload
1717
try {
18+
// Unmount root if already mounted
19+
if (root) {
20+
root.unmount()
21+
}
22+
1823
// Shim the canvas into a fake window/document
1924
Object.assign(canvas, {
2025
pageXOffset: left,

0 commit comments

Comments
 (0)