Skip to content
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

Support hot reload for server components #113

Closed
Tracked by #24
tom-sherman opened this issue Jul 28, 2023 · 11 comments · Fixed by #459
Closed
Tracked by #24

Support hot reload for server components #113

tom-sherman opened this issue Jul 28, 2023 · 11 comments · Fixed by #459
Assignees
Labels
enhancement New feature or request

Comments

@tom-sherman
Copy link

Unless I'm mistaken waku dev only supports full-page reload with HMR right now, could it support react fast refresh?

@dai-shi
Copy link
Owner

dai-shi commented Jul 28, 2023

Fast refresh should work if you only modify client components. If a file is used both by client components and server components, it will full reload.

@tom-sherman tom-sherman changed the title Support fast refresh? Support fast refresh for server components? Jul 29, 2023
@tom-sherman
Copy link
Author

Ah cool. It would be great to support fast refresh of server components then! This is possible in Next.js.

@dai-shi
Copy link
Owner

dai-shi commented Jul 30, 2023

Yeah, if it's technically possible, we could do it. As Vite (probably) supports only fast refresh of client components, to support that of server components, Waku would need its own mechanism...

@tom-sherman
Copy link
Author

tom-sherman commented Jul 30, 2023

Yep. I'm hoping vite allows you to extend the websocket messages so that it could say something like {type: refresh, component: App} and that would trigger Waku client to re-fetch the RSC.

@dai-shi dai-shi added the enhancement New feature or request label Jul 30, 2023
@dai-shi dai-shi mentioned this issue Oct 6, 2023
76 tasks
@ojj1123
Copy link
Contributor

ojj1123 commented Dec 27, 2023

@dai-shi
I'm interested in it!
Out of curious, I was wondering if I could find where you refer to make vite-plugin-rsc-reload.

I try to find the references about RSC fast refresh, but I could do it just in Next.js. It seems like that Vercel made HotReloaderWebpack module to fast-refresh a various of changes such as clientComponentChanges, serverComponentChanges, etc.

What I make vite rsc fast-refresh plugin is a bit challenge, but I would like to invest it

@dai-shi
Copy link
Owner

dai-shi commented Dec 27, 2023

Yeah, it will be challenging. We need to detect the server component changes and then do RSC refetch.

@dai-shi
Copy link
Owner

dai-shi commented Jan 11, 2024

this has a priority after v0.19.0.
i'll eventually work on it, but not soon. meantime, feel free to tackle it.

@ojj1123
Copy link
Contributor

ojj1123 commented Jan 11, 2024

i was investigating but It's a bit hard for me to solve this issue cause i don't have enough knowledge about the vite bundler.
but yeah i will try to do this :)
If someone have the solution, feel free to catch it

@dai-shi
Copy link
Owner

dai-shi commented Jan 12, 2024

Please feel free. We are all new to this stuff. You will learn something trying this, even if you don't reach the final solution. Challenging is good.

@dai-shi
Copy link
Owner

dai-shi commented Jan 21, 2024

As it seems there is a high demand on this #404, I will work on this with priority.

@dai-shi
Copy link
Owner

dai-shi commented Feb 6, 2024

I will call it "hot reload", because what I will do is not React Fast Refresh, nor HMR.

@dai-shi dai-shi changed the title Support fast refresh for server components? Support hot reload for server components? Feb 6, 2024
@dai-shi dai-shi changed the title Support hot reload for server components? Support hot reload for server components Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants