Skip to content

Commit e519c24

Browse files
committed
Add migration for availableAssets
1 parent b0b3c41 commit e519c24

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ MinusX is organized as a yarn workspace monorepo with 3 main packages:
7777
- **Settings Access**: `web/src/app/appSettings.ts` exposes a curated subset of Redux settings to apps workspace via `RPCs.getAppSettings()`
7878

7979
### Development Best Practices
80+
- **CRITICAL - Redux State Migrations**: ANY change to Redux reducer state structure MUST include a corresponding migration in `web/src/state/store.ts`. This is non-negotiable - missing migrations cause production crashes for existing users with persisted state. Always increment the version number and add migration logic to initialize new fields.
8081
- **Concurrency Control**: Batch API calls to prevent resource exhaustion when fetching data for multiple entities
8182
- **Settings Pattern**: New settings require updates in reducer, settings UI, and `appSettings.ts` for cross-workspace access
8283
- **Code Reuse**: When implementing similar logic in multiple places, extract reusable functions to shared modules rather than duplicating code

web/src/state/store.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,14 +484,20 @@ const migrations = {
484484
// Add embed_configs to settings
485485
newState.settings.embed_configs = {}
486486
return newState
487+
},
488+
54: (state: RootState) => {
489+
let newState = {...state}
490+
// Add availableAssets to settings
491+
newState.settings.availableAssets = []
492+
return newState
487493
}
488494
}
489495

490496
const BLACKLIST = ['billing', 'cache', userStateApi.reducerPath, atlasApi.reducerPath]
491497

492498
const persistConfig = {
493499
key: 'root',
494-
version: 53,
500+
version: 54,
495501
storage,
496502
blacklist: BLACKLIST,
497503
// @ts-ignore

0 commit comments

Comments
 (0)