feat(migrate): update migration logic to remove specific mini app from state and increment version to 89

This commit is contained in:
kangfenmao 2025-04-04 11:54:24 +08:00
parent c11adc01dc
commit a3d124b9fd
2 changed files with 17 additions and 4 deletions

View File

@ -42,7 +42,7 @@ const persistedReducer = persistReducer(
{
key: 'cherry-studio',
storage,
version: 88,
version: 89,
blacklist: ['runtime', 'messages'],
migrate
},

View File

@ -24,6 +24,13 @@ function removeMiniAppIconsFromState(state: RootState) {
}
}
function removeMiniAppFromState(state: RootState, id: string) {
if (state.minapps) {
state.minapps.enabled = state.minapps.enabled.filter((app) => app.id !== id)
state.minapps.disabled = state.minapps.disabled.filter((app) => app.id !== id)
}
}
// add provider to state
function addProvider(state: RootState, id: string) {
if (!state.llm.providers.find((p) => p.id === id)) {
@ -1159,12 +1166,18 @@ const migrateConfig = {
state.mcp.servers = [{ ...defaultServer, id: nanoid() }, ...state.mcp.servers]
}
}
return state
} catch (error) {
return state
}
},
'89': (state: RootState) => {
try {
removeMiniAppFromState(state, 'aistudio')
return state
} catch (error) {
console.error(error)
return state
}
return state
}
}