question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Breaking change on persist middleware

See original GitHub issue

Since this PR https://github.com/pmndrs/zustand/pull/894 (and release 3.7.2), the persist middleware now makes our selectors return undefined.

I first thought it was caused because of rehydration issues, but the onRehydrateStorage fires before the exceptions related to finding undefined instead of the expected value.

Our store is composed of slices like this:

const createRootSlice = (
  set: SetState<any>,
  get: GetState<any>,
  api: StoreApiWithPersist<any>
) => {
  return {
    ...persist(createAgentsStoreSlice, {
      name: "agents",
      partialize: (state) => {
        return {
          agentsEntriesByAssetTokenAddress:
            state.agentsEntriesByAssetTokenAddress,
        };
      },
    })(set, get, api),
    ...[OTHER SIMILAR SLICES],
  }
}

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
dai-shicommented, Jul 26, 2022

Closing this. Please open a new issue with a reproduction.

1reaction
dai-shicommented, Apr 11, 2022

Thanks for reporting! (It’s unfortunate that we have no plan to release v3 anymore. So, please use v3.7.1 meanwhile. tbh, it was good that we released v3.7.2 before v4 to get this issue.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Persist middleware - Zustand Documentation
If you want to introduce a breaking change in your storage (e.g. renaming a field), you can specify a new version number. By...
Read more >
Change Log - Redux-Bundler documentation
Breaking change to createCacheBundle . It now takes an options object as an argument instead of just a cache function. This allows us...
Read more >
NEXT.JS with persist redux showing unexpected behaviour
My working store in Next.js app. Try to fix your store. store.js import { createWrapper } from 'next-redux-wrapper'; ...
Read more >
Migrating from V1 | The React Native Boilerplate - GitHub Pages
This is not really a migration guide because there is so much breaking changes between the two versions and mostly because of the...
Read more >
Redux: Persisting the State to the Local Storage - Egghead.io
We will learn how to use store.subscribe() to efficiently persist some of the ... Redux: Fetching Data on Route Change ... Redux: Applying...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found