Skip to content

Commit

Permalink
add examples for future_blade
Browse files Browse the repository at this point in the history
  • Loading branch information
YeonV committed Jan 19, 2025
1 parent 04a70ee commit 82718f7
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/store/migrate.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/* eslint-disable no-unused-vars */
/* eslint-disable @typescript-eslint/no-unused-vars */

import { produce } from 'immer'

export interface MigrationState {
[key: string]: any
}
Expand All @@ -9,14 +12,17 @@ interface Migrations {
}

export const migrations: Migrations = {
// Removes an existing function (deprecatedFunction)
13: (state) => {
const { deprecatedFunction, ...rest } = state
return {
...rest
// Remove a deprecated function
// Adds a new key
11: produce((draft) => {
draft.uiPersist = draft.uiPersist || {}
draft.uiPersist.testZustand = { test: true }
}),
// Removes a key
12: produce((draft) => {
if (draft.uiPersist) {
delete draft.uiPersist.testZustand
}
},
}),

// Removes an existing value (deprecatedValue) and repositions an existing value (existingValue) based on another value (anotherValue)
14: (state) => {
Expand All @@ -38,8 +44,5 @@ export const migrations: Migrations = {
}),

16: (state) => ({ ...state }),
17: (state) => ({
...state
// Add new state properties or transform existing ones
})
17: (state) => ({ ...state })
}

0 comments on commit 82718f7

Please sign in to comment.