Skip to content

Commit c934762

Browse files
committed
don't create portal root if it exists
1 parent e55ff57 commit c934762

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/lib/portal-root.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ let root
1010
// <DialogPrimitive.Portal container={portalRoot} {...props} />
1111
// )
1212
if (typeof document !== "undefined") {
13-
root = document.createElement("div")
13+
const id = "react-redis-browser-portal-root"
14+
15+
root = document.querySelector(`#${id}`) ?? document.createElement("div")
1416

1517
root.classList.add("ups-db")
18+
root.id = "react-redis-browser-portal-root"
1619

1720
document.body.append(root)
1821
}

0 commit comments

Comments
 (0)