Raynos / mercury

A truly modular frontend framework
http://raynos.github.io/mercury/
MIT License
2.82k stars 143 forks source link

live component reloading #178

Open mpal9000 opened 9 years ago

mpal9000 commented 9 years ago

How to achieve live reloading for components, while keeping the current state atom intact? Something like https://github.com/gaearon/react-hot-loader or https://github.com/gaearon/react-hotify but in a "mercury" way, ie. take advantage of the single state atom and the immutable data structures. I am using webpack but there are a couple more ways for hot module reloading, eg. https://github.com/caspervonb/amok or https://github.com/geelen/jspm-server (have not tried any of those two).

yoshuawuyts commented 9 years ago

Not sure what the perf implications are, but it's fairly easy to write to localstorage on change and on reload initialize the state based on the latest snapshot from localstorage.

ashnur commented 9 years ago

It might be worth looking at how figwheel does it.

mpal9000 commented 9 years ago

@yoshuawuyts I am sure that it can be done in a few different ways and that the single state atom is a key to create this functionality with great results. I was hoping that someone had already tried it.

@ashnur Intresting, I will have a look... Maybe a section in the docs that includes related libraries and tools in other functional languages, would be helpful.

crabmusket commented 8 years ago

See #180 for a simple example :)

mpal9000 commented 8 years ago

@eightyeight Great, thanks! I will try ASAP

martintietz commented 8 years ago

See #185 for an example of hot reloading using browserify.