-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React Developer Tools doesn't work on first render #25
Comments
Hey @ruigouveiamaciel, thank you so much for digging into it. Adding The documentation of Vike's V1 design is in construction, as well as the documentation of And we want the documentation specific to vike-react to live in this repo. Feel free to give a shot at writing some documentation and we'll maybe just move it at some point. Thanks! |
Hey @AurelienLourot, About 4 years ago I recall having a similar issue with the React Developer Tools and it was because the framework I was using at the time was not preserving I also noticed that the issue mostly only happens to the If you want to read more about |
Thanks and I can reproduce the issue by the way. PRs welcome! |
@AurelienLourot I didn't read the whole thread, is there something actionable or can we close this? |
@brillout we can just add |
Hm, that's surprising: seems like React (or more likely its dev tool) is touching the
Makes me think that I guess we can add it to How about this: we add it to |
Does this matter? Users who haven't installed the React Developer Tools won't be affected anyways and for the users having it installed, I guess it's fine if that means more data usage? |
Are we sure it's only set for users who installed the dev tool browser extension? How about users who installed it but don't open the browser dev tool? |
I think $$typeof is part of the React documentation for the component class. Also the $$type is only needed during development, they could be a check to disable it after |
Neat, I've written a fix based on that assumption. It's released in Apologies for the late handling of that issue. We'll be quicker now that I believe In case I didn't ask before: would your company be up for sponsoring? |
Sadly I had to move away from my company because the CEO became a hype man/finance bro and ruined everything. Classic startup moment. They also trashed all of the Vite code I had written just because it was me that had written it, so they don't even use Vite anymore. On my new job we're not using Vite so no luck there either. |
I see. Thanks for the conversation. |
Issue description
Whenever you try to render a page for the first time (in development mode), the React Developer Tools will timeout and error.
Other behaviors
Some components, for some odd reason, never timeout and actually work, such as the
Logo
component. However, in the /examples/ssr-spa, theLink
component seems to always timeout of the first render.Sometimes React Developer Tools will straight up just refuse to even load the DOM
Because this example is using client routing, whenever you switch to another page and then page to the same page React Developer Tools will not timeout anymore and work as expected.
Screencast.from.03-10-2023.11.38.08.webm
Fix suggestion
I believe the root of the issue is because the first render is handled by onRenderHtml, which handles the creation of the page. The client, on the first render, only hydrates the page and therefore is lacking some information required by React Developer Tools.
After the first render, client routing takes control and therefore there's no longer the issue of the client missing any information required by the React Developer Tools.
I found out that by adding
'$$typeof'
to passToClient fixes this issue.I was going to make a pull request for this, however this seems like a very small change and I don't know if it's the best approach to fixing it.
It would also be useful to extend the documentation with this information for people that are trying to build their own renderers/frameworks.
If you're happy with my proposed fix, I could go ahead and create a pull request for both the issue and the documentation. However I don't know what's the most appropriate place to document this.
The text was updated successfully, but these errors were encountered: