Skip to content

test(rsc): add navigation example #567

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

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

grahammendick
Copy link

@grahammendick grahammendick commented Jul 13, 2025

Copied over from vite-plugins.

Hi @hi-ogawa , thank you for working on a vite rsc implementation.

I'm the author of the Navigation router, an rsc framework for react. I'd already written example rsc apps to test out parcel and webpack. So I've started to do the same for your vite implementation. This PR isn't meant to be merged but is a good way to communicate any issues I find.

I cloned your basic example and copied in the files from my working parcel example. When I run npm run dev the ssr works but the hydration fails. It fails because the react context isn't populated as expected. It seems like vite has 2 versions of the file - 1 inside the bundled navigation-react.js and one standalone. You can see in the screenshot below it says "from SceneRSCView" instead of "from navigation-react.js". The react context is created from navigation-react.js so it can't be found if it's not accessed the same way. This is just my guess as to what's going wrong.

Screenshot 2025-07-13 at 10 30 57

For some background, The navigation-react package has different exports for server and client and has internal client boundaries. The SceneRSCView, where the error is happening, is one of these.

Thanks again for all your work.

@grahammendick
Copy link
Author

@hi-ogawa I can't get npm run build/preview to work, although it was working on vite-plugins and hydration worked in that case.

image

@grahammendick
Copy link
Author

I'll continue work in vite-plugins PR for now because build/preview works there

@hi-ogawa hi-ogawa changed the title React Context not found during hydration in dev mode test(rsc): React Context not found during hydration in dev mode Jul 14, 2025
@hi-ogawa hi-ogawa marked this pull request as draft July 14, 2025 00:55
@hi-ogawa hi-ogawa changed the title test(rsc): React Context not found during hydration in dev mode test(rsc): add navigation example Jul 14, 2025
@hi-ogawa
Copy link
Contributor

Thanks for the PR! The build error was because there was a copy of examples/basic specific test case, which should be removed from the example

The dev error is due to Vite's deps optimization. I added optimizeDeps.include/exclude in vite.config.ts to fix this.

It looks like navigation has some issues (both dev and build) and also there's typescript error, which I'm not sure about. Please continue integration and feel free to ask me if anything unclear about Vite RSC. Thanks!

@grahammendick
Copy link
Author

@hi-ogawa Thank you, that's amazing 🙏

The built-in vite hydrate does too much - handles navigation, for example, which is no good because router needs to handle it
Also renamed to Shell to match other navigation rsc examples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants