solidjs / solid-refresh

MIT License
85 stars 18 forks source link

HMR not working correctly #26

Closed deluksic closed 1 year ago

deluksic commented 1 year ago

Describe the bug

Modifying a component does not result in updated DOM.

EDIT: I'm not sure this is solid-js issue, however I believe it is reasonable to start here and then see if vite is the culprit.

Your Example Website or App

https://github.com/deluksic/solid-fast-refresh-repro

Steps to Reproduce the Bug or Issue

ORDER OF OPERATIONS IS IMPORTANT!!

1) run the server and open in the browser.

pnpm install
pnpm start --open

2) modify and save Sub.tsx, counter should not increase, changes are applied. 3) save App.tsx, counter should increase by 1. 4) modify Sub.tsx, observe no changes in the browser.

From then on, saving App.tsx will correctly use most recent Sub.tsx, but saving Sub.tsx will not rerender the component.

Expected behavior

After those steps, I'm expecting to see changes applied to the DOM after modifying Sub.tsx.

Platform

deluksic commented 1 year ago

Sorry about not using StackBlitz for this case, but I was not able to reproduce in that environment. Seems like they do something fancy with auto-saving.

katywings commented 1 year ago

@deluksic I am preparing a PR with a fix for this at this very moment :).

deluksic commented 1 year ago

Fixed by #27