Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions frontend/src/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { LottieAnimation } from 'lottie-web-vue'

import { AxiosError } from 'axios'
import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import { createApp } from 'vue'

import './ui-components/index.scss'
Expand All @@ -19,15 +21,21 @@ import Alerts from './services/alerts.js'
import { setupSentry } from './services/error-tracking.js'
import { getServiceFactory } from './services/service.factory.js'
import store from './store/index.js'
import { skipResetPlugin } from './stores/plugins/skip-reset.plugin.js'

import './index.css'

import ForgeUIComponents from './ui-components/index.js'

store.commit('initializeStore')

const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)
pinia.use(skipResetPlugin)

const app = createApp(App)
.use(ForgeUIComponents)
.use(pinia)
.use(store)
.use(router)
.use(VueShepherdPlugin)
Expand Down
22 changes: 21 additions & 1 deletion frontend/src/store/modules/account/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { getActivePinia } from 'pinia'
import { nextTick } from 'vue'

import flowBlueprintsApi from '../../../api/flowBlueprints.js'
Expand Down Expand Up @@ -504,7 +505,26 @@ const actions = {
},
async logout ({ rootState, dispatch, commit }) {
return userApi.logout()
.then(() => dispatch('$resetState', null, { root: true }))
.then(() => {
// Reset Vuex state (existing behaviour)
dispatch('$resetState', null, { root: true })

// Reset migrated Pinia stores — uncomment each line as its store is migrated
const pinia = getActivePinia()
if (pinia) {
// Task 1: useUxDialogStore().$reset()
// Task 2: useUxToursStore().$reset()
// Task 3: useUxNavigationStore().$reset()
// Task 4: useUxDrawersStore().$reset()
// Task 5: useContextStore().$reset()
// Task 6: useProductTablesStore().$reset()
// Task 7: useProductBrokersStore().$reset()
// Task 8: useProductAssistantStore().$reset()
// Task 9: useProductExpertFfAgentStore().$reset()
// Task 10: useProductExpertOperatorAgentStore().$reset()
// Task 11: useProductExpertStore().$reset()
}
})
.catch(_ => {})
.finally(() => {
if (window._hsq) {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/stores/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Barrel export — add store exports here as each task is merged
11 changes: 11 additions & 0 deletions frontend/src/stores/plugins/skip-reset.plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export function skipResetPlugin ({ store, options }) {
const skipKeys = options.skipReset || []
const originalReset = store.$reset?.bind(store)

store.$reset = () => {
const preserved = {}
skipKeys.forEach(key => { preserved[key] = store[key] })
if (typeof originalReset === 'function') originalReset()
store.$patch(preserved)
}
}
Loading
Loading