Skip to content

discovery(frontend-test): LiveEventService.ts:371 setTimeout calls useUserStore() with no active Pinia β€” unhandled error in any router-importing testΒ #10085

Closed

Description

@mrveiss

Found during #9984 / PR #10083 verification

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.

Activity

  1. mrveiss commented on Jun 14, 2026

    @mrveiss
    OwnerAuthor

    βœ… 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions