What changed (plus any additional context for devs)
Couple of issues are happening right now
For state userChains we could update version to SUPPORTED_CHAINS.length so if there's a new change we don't have to update the version number manually and zustand migrates automatically.
This works in state/userChains but it doesn't in state/rainbowChains because we're using persistOptions that doesn't allow this.
persistOptions needs to manually pass a new migration function on every version bump which is not ideal and is causing additional issues for this case in particular: if rainbowChains updates with a new chain, the migration doesn't pick it automatically, I had to add
function v10(state: unknown) {
const rnbwState = state as RainbowChainsState;
rnbwState.rainbowChains = getInitialRainbowChains();
return rnbwState;
},
which is manually adding the new chains, we need another way to handle this state bumps automatically
Fixes BX-#### Figma link (if any):
What changed (plus any additional context for devs)
Couple of issues are happening right now
For state userChains we could update
version
toSUPPORTED_CHAINS.length
so if there's a new change we don't have to update the version number manually and zustand migrates automatically.This works in
state/userChains
but it doesn't instate/rainbowChains
because we're usingpersistOptions
that doesn't allow this.persistOptions
needs to manually pass a new migration function on every version bump which is not ideal and is causing additional issues for this case in particular: ifrainbowChains
updates with a new chain, the migration doesn't pick it automatically, I had to addwhich is manually adding the new chains, we need another way to handle this state bumps automatically
Screen recordings / screenshots
What to test