Skip to content
ReferenceVersion 6.0.2

Stores ​

Pinia manages cross-page state. Import getters and actions from @/store, read refs with .value, and use actions for changes. State owned by one component or page can stay in a local ref.

StoreAccessPersistence
SettinguseSettingGetters / useSettingActionsLocal Storage key piniaSettingStore excludes the lock configuration dialog. The current language is also stored separately.
MenuuseMenuGetters / useMenuActionsLocal Storage retains the sidebar's collapsed state. Open tabs use Session Storage. Selection is derived from the current route.
KeepAliveuseKeepAliveGetters / useKeepAliveActionsSession Storage retains names eligible for caching.
RuntimeuseRuntimeGetters / useRuntimeActionsLives for the current Pinia instance.
Lock ScreenuseLockScreenGetters / useLockScreenActionsLegacy Local Storage boolean with cross-tab sync.
SigninguseSigningGetters / useSigningActionsProfile and permissions live in memory and are restored from the session API. Bearer mode stores the token in Local Storage.

Initialization and extension ​

setupStore(app) installs Pinia and its persistence plugin. Unmount releases the Pinia instance and scope. The template entry point already installs them. Access Menu and Signing from a component's active setup context when using APIs that depend on routing.

Add each store under apps/admin/src/store/modules with a unique ID. For persistence, use pick or omit, a suitable storage area and stable key, and serializable data. Put the accessors under apps/admin/src/store/hooks and export them from apps/admin/src/store/index.ts. Raw pinia…Store exports are available internally. Pages should use hooks to reduce coupling to implementation fields.

Cache keys and JSON formats are data contracts. Consider reads, migration, and fallback for old values before changing keys, fields, or serialization. Keep server secrets out of browser storage.

Initialization and exports · Store conventions