solidjs / solid-refresh

MIT License
86 stars 18 forks source link

fix: memoize esm component getter/setter in hot.data (#26) #27

Closed katywings closed 1 year ago

katywings commented 1 year ago

Background

This uses vite hot.data to store and recover previous component getter/setters. Without it, child components are not able to get updated after a change in the parent component, as mentioned in #26.

The goal of this fix was to change as few things as possible in solid-refresh, because as discussed with @lxsmnsyc solid-refresh is getting a proper larger rework soon-ish anyways.

Reproduction

  1. Clone: https://github.com/katywings/solid-hmr-lost-signals
  2. Disable the "overrides" section in "package.json"
    • The overrides section already includes my github repository with the fix
  3. Follow instructions in https://github.com/katywings/solid-hmr-lost-signals

Bildschirmaufzeichnung vom 2022-12-22, 13-40-11.webm

How did I test the changes

Tested vite versions

deluksic commented 1 year ago

Tested on my project, it works great. Thank you!

ryansolid commented 1 year ago

Thank you so much. I know how tricky these things can be to track down.

katywings commented 1 year ago

@ryansolid @lxsmnsyc Thank you for your code review, merge and the snazzy release! :)