mattkrick / redux-optimistic-ui

a reducer enhancer to enable type-agnostic optimistic updates
MIT License
693 stars 36 forks source link

Add a helper function to preload state with an initial state that works with optismitic #18

Closed clayne11 closed 7 years ago

clayne11 commented 7 years ago

When redux initializes it passes a couple of actions to each reducer. This initialization was sets the "isReady" flag. If we have an initial state coming from outside of the reducer, however, then on the actual @@INIT pass the isReady flag would be true and the state be defined even though it isn't actually initialized.

In this instance, use the preloadState function to pass in the initial value so it's already set up for optimistic.

Fixes #16

coveralls commented 7 years ago

Coverage Status

Coverage increased (+7.7%) to 92.308% when pulling a8b525fd29ef7735ecb1e8bbbeb2da511b3a64c8 on clayne11:preload into e443f0900ceaede36691d799efc6dfd12b048c86 on mattkrick:master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+7.7%) to 92.308% when pulling da3aa1d8997e69bdec98a5b91a1c9f1cef47fb3e on clayne11:preload into e443f0900ceaede36691d799efc6dfd12b048c86 on mattkrick:master.

clayne11 commented 7 years ago

Hey @mattkrick how does this one look? I took your input from #16.

mattkrick commented 7 years ago

hey @clayne11 sorry for the delay. this looks great! will push to npm in a moment.

mattkrick commented 7 years ago

live in v0.5.0