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
Is your feature request related to a problem? Please describe
Summary
Recent work (for example, PR #4781) migrated the GPS tab UI from jQuery to Vue and introduced Pinia stores that currently proxy legacy global singletons (FC, GUI, CONFIGURATOR, etc.) via computed getters and setters. This issue tracks the follow-up migration to make Pinia the authoritative, independent single source of truth (SSoT), remove the legacy singletons, and centralize side effects (MSP, persistence) inside Pinia actions.
Motivation
Cleaner architecture and separation of concerns
More predictable and robust reactivity (avoid subtle proxy edge cases)
Easier unit testing and component isolation
Simplified future development and reduced long-term technical debt
actions:load(), save(), poll(), hydrateFromLegacy(), plus focused actions like loadGpsConfig() and saveGpsConfig()
connectionStore
state + actions to manage connection lifecycle, port info, reconnect flow, etc.
navigationStore, dialogStore, gpsStore (map UI state), featuresStore, etc.
Hydration strategy
Add explicit store.hydrateFromLegacy(legacySource) actions that copy a snapshot of legacy singletons into Pinia on app start or on-demand (for example, tab mount).
Keep hydration deterministic and explicit (no implicit copying).
Synchronization adapter (migration bridge)
Implement a central adapter module that handles write-through from Pinia to legacy singletons during the transition.
The adapter is the only code path that writes to legacy singletons.
Pinia actions call the adapter when necessary.
Debounce and throttle adapter writes for high-frequency updates.
Expose a small API, for example:
syncToLegacy(storeName, changes)
syncFromLegacy(...) (optional, when needed)
Centralize side effects
Move MSP calls, persistence (mspHelper), and long-running polling or intervals into store actions so components remain pure consumers.
Example:
flightControllerStore.actions.loadGpsConfig() and saveGpsConfig() wrap MSP.promise calls.
Migration workflow (incremental)
New Vue components and new work read from Pinia only.
Legacy code can keep read-only access for a transition window.
Writes funnel through Pinia actions, which use the adapter so legacy code sees updates.
Migrate one tab fully to Pinia-first (GPS is a strong candidate after PR Migrate GPS tab to Vue component #4781), validate behavior, then migrate remaining tabs in small PRs.
After most call sites (for example, >90%) use Pinia, flip authoritative direction: Pinia becomes SSoT and the adapter stops writing back.
Remove legacy singletons and proxy code after verification.
Testing, observability, and ergonomics
Unit tests for store actions and adapter behavior
Integration tests for MSP and polling flows, plus map and telemetry behavior
Optional migration logging to detect stale-access patterns during transition
Document store public APIs and a migration guide
Use PR labels like pinia-migration to track progress
Describe alternatives you've considered
Keep proxying legacy singletons (status quo)
Pros: lowest short-term risk, fastest for UI shipping, minimal churn
Cons: preserves technical debt, continued coupling to globals, fragile reactive behavior, harder to test
Verdict: acceptable short term, not a long-term solution
Event bus or message-passing bridge
Pros: decouples without immediate singleton replacement
Cons: harder to reason about state, higher race risk, still not a clean SSoT
Verdict: useful for one-off cases, not ideal for full migration
Is your feature request related to a problem? Please describe
Summary
Recent work (for example, PR #4781) migrated the GPS tab UI from jQuery to Vue and introduced Pinia stores that currently proxy legacy global singletons (
FC,GUI,CONFIGURATOR, etc.) via computed getters and setters. This issue tracks the follow-up migration to make Pinia the authoritative, independent single source of truth (SSoT), remove the legacy singletons, and centralize side effects (MSP, persistence) inside Pinia actions.Motivation
Goals
Describe the solution you'd like
Stores and APIs
Implement dedicated Pinia stores per domain with stable public APIs:
flightControllerStore{ config, gpsConfig, gpsData, features, compassConfig, sensorData, ... }load(),save(),poll(),hydrateFromLegacy(), plus focused actions likeloadGpsConfig()andsaveGpsConfig()connectionStorenavigationStore,dialogStore,gpsStore(map UI state),featuresStore, etc.Hydration strategy
store.hydrateFromLegacy(legacySource)actions that copy a snapshot of legacy singletons into Pinia on app start or on-demand (for example, tab mount).Synchronization adapter (migration bridge)
syncToLegacy(storeName, changes)syncFromLegacy(...)(optional, when needed)Centralize side effects
mspHelper), and long-running polling or intervals into store actions so components remain pure consumers.flightControllerStore.actions.loadGpsConfig()andsaveGpsConfig()wrapMSP.promisecalls.Migration workflow (incremental)
Testing, observability, and ergonomics
pinia-migrationto track progressDescribe alternatives you've considered
Keep proxying legacy singletons (status quo)
Event bus or message-passing bridge
Convert legacy singletons to reactive wrappers
One big Pinia-first rewrite
Switch state managers (Vuex or custom)
Proposed migration plan (incremental, low-risk)
hydrateFromLegacy(legacySource)actions per storeImplementation details and best practices
hydrateFromLegacy()), deterministic, and discoverableAcceptance criteria
Risks and mitigations
Suggested metadata
refactor,tech-debt,pinia,vue,pinia-migrationhaslinghuisorErics1337)Checklist
hydrateFromLegacy(legacySource)for each storeOther information
No response