cyclejs-community / redux-cycles

Bring functional reactive programming to Redux using Cycle.js
MIT License
746 stars 30 forks source link

Hot reloading #34

Open lmatteis opened 7 years ago

lmatteis commented 7 years ago

Someone on gitter pointed out that hot reloading isn't possible with redux-cycles. We should have a solution for this. Tagging this as enhancement

lmatteis commented 7 years ago

An interesting approach to hot-reloading would be to mock all side effects when calling Cycle.run. For instance during development you don't actually want to perform certain HTTP request - GET requests you may want them to go through, but not POSTs/PUTs.

There could be a way to pass a HOD (high order driver) that wraps HTTP driver and filters POSTs/PUTs request to not contact server; but just return mock data-- so the UI can be used without modifying server-state.

goshacmd commented 7 years ago

In general, isn't hot reloading of any Redux side-effect approach a huge pita? Both sagas and cycles can have local, implicit state which can make hot-reloading useless in many cases even if cycles can be rebooted.

An alternative could be to keep track of action history and replay on hot reload, but this can be problematic as well... because changes in cycles can now change the past.

lmatteis commented 7 years ago

Wondering whether https://github.com/Widdershin/cycle-restart will work

Widdershin commented 7 years ago

You could probably adapt cycle-restart for this usecase, it might just work™.