aidenybai / aidenybai/react-scan

It doesn't work in multi-window setup based on `window.open` and `createPortal`

Open
#433 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
21.8k
Forks
390
Avg merge
23m
Merged PRs (30d)
1

Description

I want to add react-scan to Electron app that renders into multiple windows from the same JavaScript thread using `const newWindow = window.open` and then `createPortal(, newWindow)`.

In that case react-scan seems not to work at all

https://pietrasiak.com/creating-multi-window-electron-apps-using-react-portals#aad5d08cfa4d413a8ff6979ebe267fa3

I've wrote article on quirks of this setup

eg.
- `instanceof HTMLElement` will not work as it should be `instanceof ownerWindow.HTMLElement`
- highlights div cannot be created like `document.createElement(), document.body.appendChil` - needs `ownerWindow.documentElement`
- it essentially needs one highlighter per window in which react fiber renders

I understand it is quite major edge case, so not expecting it to be adjusted, just wanted to let you know

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.