oedotme / generouted

Generated file-based routes for Vite
https://stackblitz.com/github.com/oedotme/generouted/tree/main/explorer
MIT License
1.02k stars 47 forks source link

No HMR in Action - need to refresh #139

Closed henrikvilhelmberglund closed 9 months ago

henrikvilhelmberglund commented 9 months ago

Describe the Bug

No HMR in Action - need to refresh. I think this was fixed before but it doesn't seem to work for me which led to some confusion. I can see a Vite hmr update message however the code inside the Action function isn't updated until I refresh the page.

Is there something I might need to do to make this work or is it a bug?

Generouted Version

1.16.1

Your Example Website or App or Reproduction

https://stackblitz.com/edit/github-4pbpiu?file=src%2Fpages%2Flogin-b%2Findex.tsx

Steps to Reproduce the Bug or Issue

  1. Go to index.tsx in login-b.
  2. Open the developer console and press Submit, you should see hello.
  3. Change the text to "hello2".
  4. Press Submit again.

Expected Behavior

Expected: You see the text "hello2". Result: You see the text "hello".

Screenshots or Videos

No response

Platform

Additional context

No response

oedotme commented 9 months ago

Hey @henrikvilhelmberglund, AFAIK that's the expected behavior. HMR and fast-refresh are specific to React components. Here are some related issues #5, https://github.com/vitejs/vite-plugin-react/issues/34, vitejs/vite-plugin-react-swc#consistent-components-exports

henrikvilhelmberglund commented 9 months ago

Hey @henrikvilhelmberglund, AFAIK that's the expected behavior. HMR and fast-refresh are specific to React components. Here are some related issues #5, vitejs/vite-plugin-react#34, vitejs/vite-plugin-react-swc#consistent-components-exports

Ok, thanks!

(I wonder how they got it working in Remix https://twitter.com/CoEliya/status/1716222289845330039

oedotme commented 9 months ago

@henrikvilhelmberglund I think it might be Vite based plugin or modification of the react-refresh plugin in order to make it possible. If it's done with a Vite plugin, there's a possibility of having this added to generouted plugin as well in the future.