-
-
Notifications
You must be signed in to change notification settings - Fork 25
Description
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
Logocomponent. However, in the /examples/ssr-spa, theLinkcomponent 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.
// /vike-react/renderer/+config.ts
export default {
// ...
passToClient: ['pageProps', 'title', '$$typeof']
// ...
} satisfies ConfigI 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.

