File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { LottieAnimation } from 'lottie-web-vue'
22
33import { AxiosError } from 'axios'
4+ import { createPinia } from 'pinia'
5+ import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
46import { createApp } from 'vue'
57
68import './ui-components/index.scss'
@@ -19,15 +21,21 @@ import Alerts from './services/alerts.js'
1921import { setupSentry } from './services/error-tracking.js'
2022import { getServiceFactory } from './services/service.factory.js'
2123import store from './store/index.js'
24+ import { skipResetPlugin } from './stores/plugins/skip-reset.plugin.js'
2225
2326import './index.css'
2427
2528import ForgeUIComponents from './ui-components/index.js'
2629
2730store . commit ( 'initializeStore' )
2831
32+ const pinia = createPinia ( )
33+ pinia . use ( piniaPluginPersistedstate )
34+ pinia . use ( skipResetPlugin )
35+
2936const app = createApp ( App )
3037 . use ( ForgeUIComponents )
38+ . use ( pinia )
3139 . use ( store )
3240 . use ( router )
3341 . use ( VueShepherdPlugin )
Original file line number Diff line number Diff line change 1+ import { getActivePinia } from 'pinia'
12import { nextTick } from 'vue'
23
34import flowBlueprintsApi from '../../../api/flowBlueprints.js'
@@ -504,7 +505,26 @@ const actions = {
504505 } ,
505506 async logout ( { rootState, dispatch, commit } ) {
506507 return userApi . logout ( )
507- . then ( ( ) => dispatch ( '$resetState' , null , { root : true } ) )
508+ . then ( ( ) => {
509+ // Reset Vuex state (existing behaviour)
510+ dispatch ( '$resetState' , null , { root : true } )
511+
512+ // Reset migrated Pinia stores — uncomment each line as its store is migrated
513+ const pinia = getActivePinia ( )
514+ if ( pinia ) {
515+ // Task 1: useUxDialogStore().$reset()
516+ // Task 2: useUxToursStore().$reset()
517+ // Task 3: useUxNavigationStore().$reset()
518+ // Task 4: useUxDrawersStore().$reset()
519+ // Task 5: useContextStore().$reset()
520+ // Task 6: useProductTablesStore().$reset()
521+ // Task 7: useProductBrokersStore().$reset()
522+ // Task 8: useProductAssistantStore().$reset()
523+ // Task 9: useProductExpertFfAgentStore().$reset()
524+ // Task 10: useProductExpertOperatorAgentStore().$reset()
525+ // Task 11: useProductExpertStore().$reset()
526+ }
527+ } )
508528 . catch ( _ => { } )
509529 . finally ( ( ) => {
510530 if ( window . _hsq ) {
Original file line number Diff line number Diff line change 1+ // Barrel export — add store exports here as each task is merged
Original file line number Diff line number Diff line change 1+ export function skipResetPlugin ( { store, options } ) {
2+ const skipKeys = options . skipReset || [ ]
3+ const originalReset = store . $reset ?. bind ( store )
4+
5+ store . $reset = ( ) => {
6+ const preserved = { }
7+ skipKeys . forEach ( key => { preserved [ key ] = store [ key ] } )
8+ if ( typeof originalReset === 'function' ) originalReset ( )
9+ store . $patch ( preserved )
10+ }
11+ }
You can’t perform that action at this time.
0 commit comments