ngrx-store-localstorage icon indicating copy to clipboard operation
ngrx-store-localstorage copied to clipboard

update-reducers fix

Open dimitriy-k opened this issue 6 years ago • 8 comments

fix issue overwriting values with old values from rehydrated state, when reducers are updated.

Not sure if the test is needed, because update action is deleted.

dimitriy-k avatar Apr 11 '19 14:04 dimitriy-k

lgtm

ernestomancebo avatar Apr 16 '19 00:04 ernestomancebo

I'm not close enough to the project at this point to understand all of the impact this change may have. This will require a major version bump to be safe, no? @ernestomancebo @bufke

btroncone avatar Apr 23 '19 15:04 btroncone

😴😴😴

dimitriy-k avatar Apr 29 '19 20:04 dimitriy-k

Any news about when/if this PR will be completed?

fhissink avatar May 16 '19 08:05 fhissink

I'm having a tough time producing the bug. Do you have a sample project that demonstrates it? I attempted to reproduce it by logging in to an app. Reload. Manually dispatching (via redux devtools) a login action that would set a new auth token. Then navigating to a lazy loaded route. I see a update action as you mention. I did not see any old state reappear.

I see a couple people have interest in this bug. I don't feel comfortable merging without understanding the problem fully. I don't know the historical reason for checking the UPDATE_ACTION either.

I did try this patch with some of my apps including some with lazy loading and didn't notice any regressions. The unit test is helpful but it's a very controlled test and I'd like to understand how this bug effects a real project.

bufke avatar May 25 '19 13:05 bufke

I just tested the one-line fix (removing the check for action.type === UPDATE_ACTION), and it fixes the issue in our application. Anxiously awaiting this to be merged in! It actually uncovered a few other bugs in our application that had a strange dependency on the wrongly-rehydrated state!

CleverCoder avatar Jun 22 '19 00:06 CleverCoder

@BillyBlaze no one owes you their time. If you'd like to pay a contractor to support your open source software you are welcome to do so. If you think you can maintain the project better you are welcome to ask to join or fork it.

bufke avatar Jul 24 '19 17:07 bufke

I'm hesitant to merge this in as the UPDATE_ACTION was explicity added to fix a few issues back in #76, so if this is merged it's likely to reintroduce those issues.

For those that need this fix, there is a workaround https://github.com/btroncone/ngrx-store-localstorage/issues/120#issuecomment-540567596

BBlackwo avatar Apr 17 '20 07:04 BBlackwo