Skip to content

rehydratedState is not recalculated on UPDATE_ACTION #120

@dimitriy-k

Description

@dimitriy-k

rehydratedState is defined only on INIT_ACTION. When localStorage is updated and then lazy-module is loaded, UPDATE_ACTION called and old state (rehydratedState from INIT) is used.

if ((action.type === INIT_ACTION || action.type === UPDATE_ACTION) && rehydratedState) { nextState = merge({}, nextState, rehydratedState); }

Use case:

  1. Login => token is saved in localstorage
  2. Reload the page => rehydratedState created with token
  3. Login with different user => new token stored in localstorage (but not synced with rehydratedState!)
  4. Go to lazy loaded page => UPDATE_ACTION, token is overridden with old token from step 2 :(((

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions