You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
discovery(frontend-test): LiveEventService.ts:371 setTimeout calls useUserStore() with no active Pinia β unhandled error in any router-importing testΒ #10085
Running any vitest that imports @/router (e.g. nav-items-coverage.test.ts) emits an unhandled error:
Error: [π]: "getActivePinia()" was called but there was no active Pinia.
β― useStore node_modules/pinia/dist/pinia.mjs:1706:19
β― Timeout._onTimeout src/services/LiveEventService.ts:371:25
LiveEventService.ts:371 schedules a setTimeout that calls useUserStore(); in the test environment the timer fires after the test completes, with no active Pinia. Tests still pass (12/12) but vitest flags it as an unhandled error ("This will fail in production" / false-positive risk).
Likely surfaced/introduced by the strict-vue-tsc + runtime-bug PR (#9724 / #10073) which touched LiveEventService.
Fix direction
Guard the deferred useUserStore() (only call once Pinia/app is mounted), or clear the timer on teardown, or lazy-init the store inside tryConnect.
β Already fixed by #9693 (merged as #10078), which landed after this was filed. src/utils/whenPiniaReady.ts now polls getActivePinia() and only invokes useUserStore() once a Pinia instance is active (and re-defers otherwise) β used by both LiveEventService and GlobalWebSocketService. Verified on latest Dev_new_gui: vitest run src/__tests__/nav-items-coverage.test.ts β 12 passed, no Errors section / no 'no active Pinia' (was '1 error' on the pre-#10078 base). Closing as resolved.
Activity
mrveiss commentedon Jun 14, 2026
β Already fixed by #9693 (merged as #10078), which landed after this was filed.
src/utils/whenPiniaReady.tsnow pollsgetActivePinia()and only invokesuseUserStore()once a Pinia instance is active (and re-defers otherwise) β used by both LiveEventService and GlobalWebSocketService. Verified on latest Dev_new_gui:vitest run src/__tests__/nav-items-coverage.test.tsβ 12 passed, noErrorssection / no 'no active Pinia' (was '1 error' on the pre-#10078 base). Closing as resolved.