mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-25 11:20:07 +08:00
refactor: rename cache keys to follow naming convention
- Remove redundant 'ui.activeTabId' from UseCacheSchema (already in TabsState) - Rename 'tabs_state' to 'ui.tab.state' to follow ESLint naming rule - Update useTabs hook to use new cache key 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
9d6a8f9225
commit
cf7801f8ec
@ -223,8 +223,8 @@
|
||||
"@types/mime-types": "^3",
|
||||
"@types/node": "^22.17.1",
|
||||
"@types/pako": "^1.0.2",
|
||||
"@types/react": "^19.2.7",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@types/react": "^19.0.12",
|
||||
"@types/react-dom": "^19.0.4",
|
||||
"@types/react-infinite-scroll-component": "^5.0.0",
|
||||
"@types/react-transition-group": "^4.4.12",
|
||||
"@types/react-window": "^1",
|
||||
|
||||
12
packages/shared/data/cache/cacheSchemas.ts
vendored
12
packages/shared/data/cache/cacheSchemas.ts
vendored
@ -48,9 +48,6 @@ export type UseCacheSchema = {
|
||||
'topic.active': CacheValueTypes.CacheTopic | null
|
||||
'topic.renaming': string[]
|
||||
'topic.newly_renamed': string[]
|
||||
|
||||
// UI State
|
||||
'ui.activeTabId': string
|
||||
}
|
||||
|
||||
export const DefaultUseCache: UseCacheSchema = {
|
||||
@ -81,10 +78,7 @@ export const DefaultUseCache: UseCacheSchema = {
|
||||
// Topic management
|
||||
'topic.active': null,
|
||||
'topic.renaming': [],
|
||||
'topic.newly_renamed': [],
|
||||
|
||||
// UI State
|
||||
'ui.activeTabId': ''
|
||||
'topic.newly_renamed': []
|
||||
}
|
||||
|
||||
/**
|
||||
@ -123,11 +117,11 @@ export interface TabsState {
|
||||
* This ensures type safety and prevents key conflicts
|
||||
*/
|
||||
export type RendererPersistCacheSchema = {
|
||||
tabs_state: TabsState
|
||||
'ui.tab.state': TabsState
|
||||
}
|
||||
|
||||
export const DefaultRendererPersistCache: RendererPersistCacheSchema = {
|
||||
tabs_state: { tabs: [], activeTabId: '' }
|
||||
'ui.tab.state': { tabs: [], activeTabId: '' }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -7,7 +7,7 @@ export type { Tab, TabsState, TabType } from '@shared/data/cache/cacheSchemas'
|
||||
import type { Tab } from '@shared/data/cache/cacheSchemas'
|
||||
|
||||
export function useTabs() {
|
||||
const [tabsState, setTabsState] = usePersistCache('tabs_state')
|
||||
const [tabsState, setTabsState] = usePersistCache('ui.tab.state')
|
||||
|
||||
const tabs = useMemo(() => tabsState.tabs, [tabsState.tabs])
|
||||
const activeTabId = tabsState.activeTabId
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
/* eslint-disable */
|
||||
|
||||
// @ts-nocheck
|
||||
|
||||
// noinspection JSUnusedGlobalSymbols
|
||||
@ -14,7 +12,7 @@ import { Route as IndexRouteImport } from './routes/index'
|
||||
const IndexRoute = IndexRouteImport.update({
|
||||
id: '/',
|
||||
path: '/',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
getParentRoute: () => rootRouteImport
|
||||
} as any)
|
||||
|
||||
export interface FileRoutesByFullPath {
|
||||
@ -52,8 +50,6 @@ declare module '@tanstack/react-router' {
|
||||
}
|
||||
|
||||
const rootRouteChildren: RootRouteChildren = {
|
||||
IndexRoute: IndexRoute,
|
||||
IndexRoute: IndexRoute
|
||||
}
|
||||
export const routeTree = rootRouteImport
|
||||
._addFileChildren(rootRouteChildren)
|
||||
._addFileTypes<FileRouteTypes>()
|
||||
export const routeTree = rootRouteImport._addFileChildren(rootRouteChildren)._addFileTypes<FileRouteTypes>()
|
||||
|
||||
22
yarn.lock
22
yarn.lock
@ -12672,7 +12672,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/react-dom@npm:^19.0.4, @types/react-dom@npm:^19.2.3":
|
||||
"@types/react-dom@npm:^19.0.4":
|
||||
version: 19.2.3
|
||||
resolution: "@types/react-dom@npm:19.2.3"
|
||||
peerDependencies:
|
||||
@ -12726,15 +12726,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/react@npm:^19.2.7":
|
||||
version: 19.2.7
|
||||
resolution: "@types/react@npm:19.2.7"
|
||||
dependencies:
|
||||
csstype: "npm:^3.2.2"
|
||||
checksum: 10c0/a7b75f1f9fcb34badd6f84098be5e35a0aeca614bc91f93d2698664c0b2ba5ad128422bd470ada598238cebe4f9e604a752aead7dc6f5a92261d0c7f9b27cfd1
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/resolve@npm:^1.20.2":
|
||||
version: 1.20.6
|
||||
resolution: "@types/resolve@npm:1.20.6"
|
||||
@ -14083,8 +14074,8 @@ __metadata:
|
||||
"@types/mime-types": "npm:^3"
|
||||
"@types/node": "npm:^22.17.1"
|
||||
"@types/pako": "npm:^1.0.2"
|
||||
"@types/react": "npm:^19.2.7"
|
||||
"@types/react-dom": "npm:^19.2.3"
|
||||
"@types/react": "npm:^19.0.12"
|
||||
"@types/react-dom": "npm:^19.0.4"
|
||||
"@types/react-infinite-scroll-component": "npm:^5.0.0"
|
||||
"@types/react-transition-group": "npm:^4.4.12"
|
||||
"@types/react-window": "npm:^1"
|
||||
@ -16538,13 +16529,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"csstype@npm:^3.2.2":
|
||||
version: 3.2.3
|
||||
resolution: "csstype@npm:3.2.3"
|
||||
checksum: 10c0/cd29c51e70fa822f1cecd8641a1445bed7063697469d35633b516e60fe8c1bde04b08f6c5b6022136bb669b64c63d4173af54864510fbb4ee23281801841a3ce
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"csv-parse@npm:^5.6.0":
|
||||
version: 5.6.0
|
||||
resolution: "csv-parse@npm:5.6.0"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user