antfu/reactivue

weird id bug

sibbng opened this issue · 3 comments

Hi, I'm working on an issue about unmounting components.

I put some loggers in: sibbng@c98bd75

When components gets mounted, their id getting icreased. I didn't find any reason for why this is happening. This is only happening on vite dev mode. vite build is working fine.

vite version: 2.0.0-beta.23
@vitejs/plugin-react-refresh: 1.1.1

My vite project template https://github.com/sibbng/reactivue-bug

id.mp4

I have tested it with Preact. It works as expected in dev mode. Tried removing @vitejs/plugin-react-refresh on react template and tested again in dev mode. But this issue still exist :/

I have also tested it on create-react-app without reactivue, just a simple component. Same behaviour. Looks like issue is about storing that id outside of react. Probably we have to connect it to our react component with useContext or somehow. I will look into it.

I found its reason: facebook/react#15074

I will think about what we do with it. This is not really an issue if you are not using strict mode. Closing issue for now.