Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6952 +/- ##
=======================================
Coverage 76.26% 76.26%
=======================================
Files 403 403
Lines 20312 20312
Branches 4886 4886
=======================================
Hits 15490 15490
Misses 4822 4822
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
… into 6942-pinia-task-13-account-team
…nitial notifications state
frontend/src/composables/Components/multi-step-forms/instance/InstanceFormHelper.js
Outdated
Show resolved
Hide resolved
… into 6942-pinia-task-13-account-team
There was a problem hiding this comment.
This was not a small feat, I appreciate the time and work that you put into this! Most of my comments are nitpicks on naming, placement of thing or praise about cleaning house on leftovers.
There was one thing that should have caught my eyes sooner, and am now worried that it might cause so subtle of side effects that we might even not notice it. That is the loss of reactivity when destructuring pinia store properties (actions are fine).
I left a comment where I noticed it, but please re-do a quick project wide scan of pinia state destructors and use the storeToRefs helper. I know it adds a bit of scope to the current task and I take full responsibility for it as I should have caught them sooner
Here's a quick reference to my findings to help out:
Destructuring from use*Store() directly
| File | Line | Destructuring |
|---|---|---|
store/modules/account/index.js |
56 | const { user } = useAccountAuthStore() |
store/modules/account/index.js |
57 | const { team, isTrialAccount } = useContextStore() |
store/modules/account/index.js |
79 | const { teamMembership, team } = useContextStore() |
stores/_account_bridge.js |
13 | const { user } = useAccountAuthStore() |
stores/_account_bridge.js |
14 | const { team, teamMembership, isTrialAccount, isTrialAccountExpired } = useContextStore() |
stores/ux-navigation.js |
37 | const { isNewlyCreatedUser, userActions } = useUxStore() |
stores/account-team.js |
26 | const { user } = useAccountAuthStore() |
pages/account/Settings.vue |
301 | const { team, teams } = useAccountTeamStore() |
composables/.../InstanceFormHelper.js |
10 | const { team } = useContextStore() |
composables/.../InstanceFormHelper.js |
20 | const { team } = useContextStore() |
Destructuring from useAccountBridge() (bridge composable)
| File | Line | Destructuring |
|---|---|---|
stores/product-expert-insights-agent.js |
41 | const { team } = useAccountBridge() |
stores/product-expert.js |
49 | const { featuresCheck } = useAccountBridge() |
stores/product-expert.js |
67 | const { featuresCheck } = useAccountBridge() |
stores/product-expert.js |
79 | const { team } = useAccountBridge() |
stores/product-expert.js |
96 | const { featuresCheck } = useAccountBridge() |
stores/product-expert.js |
111 | const { featuresCheck } = useAccountBridge() |
stores/product-tables.js |
53 | const { team } = useAccountBridge() |
stores/product-tables.js |
59 | const { team } = useAccountBridge() |
stores/product-tables.js |
91 | const { team } = useAccountBridge() |
stores/ux-navigation.js |
418 | const { team, teamMembership } = useAccountBridge() |
stores/product-brokers.js |
18 | const { team } = useAccountBridge() |
stores/product-brokers.js |
45 | const { team } = useAccountBridge() |
stores/product-brokers.js |
50 | const { team } = useAccountBridge() |
stores/product-brokers.js |
56 | const { team } = useAccountBridge() |
stores/product-brokers.js |
62 | const { team } = useAccountBridge() |
stores/product-brokers.js |
69 | const { team } = useAccountBridge() |
stores/product-brokers.js |
83 | const { team } = useAccountBridge() |
(They may not all warrant the use of pinia's helper)
| setTeams (teams) { | ||
| this.teams = teams | ||
| }, | ||
| async setTeam (team) { |
There was a problem hiding this comment.
I feel this method should be in the context store and don't see why it shouldn't. Change my mind on why it should not be
There was a problem hiding this comment.
Here are the reasons why I left it within account-team. I understand we want to merge this today so if you still disagree I vote we move it in another task to not hold this up.
-
It owns
pendingTeamChange
pendingTeamChangestate lives on account-team.setTeamis the only thing that sets it. MovingsetTeamto context would meancontextneeds to reach back intoaccount-teamfor that state. -
It calls
clearOtherStores()
clearOtherStores()is anaccount-teamaction(useProductTablesStore().clearState()).setTeamcalls it asthis.clearOtherStores(). -
The circular dependency 🔪
account-team.js already imports useContextStore:
account-team.js → context.js
If setTeam moved to context.js, then context.js would need to import useAccountTeamStore for pendingTeamChange and clearOtherStores():
context.js → account-team.js → context.js ❌
That's a circular import and will lead to more issues down the line. This is the main reason why I didn't want to move it.
frontend/src/pages/team/Tables/Table/TableExplorer/drawers/CreateTable.vue
Show resolved
Hide resolved
|
Hi @cstns here is the summary of the fixes I made for the deconstruction/storeToRefs issues. It they were not introduced in this PR, then I didn't fix them since the diff here is already unmanageable. I'll raise another PR for a sweep of the codebase or tackle in Task 15 Teardown. Pinia Reactivity Fix TrackingDestructuring from
|
| File | Line | Destructuring | Fixed? | Notes |
|---|---|---|---|---|
store/modules/account/index.js |
56 | const { user } = useAccountAuthStore() |
✅ Yes | Fixed in this PR — storeToRefs + alias pattern |
store/modules/account/index.js |
57 | const { team, isTrialAccount } = useContextStore() |
✅ Yes | Fixed in this PR — storeToRefs + alias pattern |
store/modules/account/index.js |
79 | const { teamMembership, team } = useContextStore() |
✅ Yes | Fixed in this PR — storeToRefs + alias pattern |
stores/_account_bridge.js |
13 | const { user } = useAccountAuthStore() |
✅ Yes | Fixed in this PR — storeToRefs |
stores/_account_bridge.js |
14 | const { team, teamMembership, isTrialAccount, isTrialAccountExpired } = useContextStore() |
✅ Yes | Fixed in this PR — storeToRefs |
stores/ux-navigation.js |
37 | const { isNewlyCreatedUser, userActions } = useUxStore() |
❌ No | Not introduced in this PR — needs a separate fix |
stores/account-team.js |
26 | const { user } = useAccountAuthStore() |
✅ Yes | Fixed in this PR — direct store proxy access (useAccountAuthStore().user) to preserve test mock compatibility |
pages/account/Settings.vue |
301 | const { team, teams } = useAccountTeamStore() |
✅ Yes | Fixed in this PR — storeToRefs for teams; team corrected to read from useContextStore() (was a migration bug — team does not exist on useAccountTeamStore) |
composables/.../InstanceFormHelper.js |
10 | const { team } = useContextStore() |
✅ Yes | Fixed in this PR — storeToRefs + alias pattern |
composables/.../InstanceFormHelper.js |
20 | const { team } = useContextStore() |
✅ Yes | Fixed in this PR — storeToRefs + alias pattern |
Destructuring from useAccountBridge() (bridge composable)
Just to note - const { featuresCheck } = useAccountBridge() is still coming off of Vuex at this point in time. I will ensure this is right when I move it into Pinia in Task 14.
// in _account_bridge.js this is still Vuex.
featuresCheck: store.getters['account/featuresCheck'],
requiresBilling: store.getters['account/requiresBilling'],
| File | Line | Destructuring | Fixed? | Notes |
|---|---|---|---|---|
stores/product-expert-insights-agent.js |
41 | const { team } = useAccountBridge() |
➡️ N/A | In an action — one-shot call, reactivity does not apply |
stores/product-expert.js |
49 | const { featuresCheck } = useAccountBridge() |
➡️ N/A | In an action — one-shot call, reactivity does not apply. Also, featuresCheck comes from Vuex store.getters (direct property access, not destructured from Pinia) |
stores/product-expert.js |
67 | const { featuresCheck } = useAccountBridge() |
➡️ N/A | In an action — same as above |
stores/product-expert.js |
79 | const { team } = useAccountBridge() |
➡️ N/A | In an action — one-shot call, reactivity does not apply |
stores/product-expert.js |
96 | const { featuresCheck } = useAccountBridge() |
➡️ N/A | In an action — same as above |
stores/product-expert.js |
111 | const { featuresCheck } = useAccountBridge() |
➡️ N/A | In an action — same as above |
stores/product-tables.js |
53 | const { team } = useAccountBridge() |
➡️ N/A | In an action — one-shot call, reactivity does not apply |
stores/product-tables.js |
59 | const { team } = useAccountBridge() |
➡️ N/A | In an action — one-shot call, reactivity does not apply |
stores/product-tables.js |
91 | const { team } = useAccountBridge() |
➡️ N/A | In an action — one-shot call, reactivity does not apply |
stores/ux-navigation.js |
418 | const { team, teamMembership } = useAccountBridge() |
✅ Effectively fixed | In a getter — not introduced in this PR. Destructuring plain values from useAccountBridge() is safe: the getter reruns on dependency change, the bridge is called fresh each time, and reactive tracking flows through the bridge's internal storeToRefs accesses. No further change needed. |
stores/product-brokers.js |
18 | const { team } = useAccountBridge() |
✅ Effectively fixed | In a getter — same reasoning as above. |
stores/product-brokers.js |
45 | const { team } = useAccountBridge() |
➡️ N/A | In an action — one-shot call, reactivity does not apply |
stores/product-brokers.js |
50 | const { team } = useAccountBridge() |
➡️ N/A | In an action — one-shot call, reactivity does not apply |
stores/product-brokers.js |
56 | const { team } = useAccountBridge() |
➡️ N/A | In an action — one-shot call, reactivity does not apply |
stores/product-brokers.js |
62 | const { team } = useAccountBridge() |
➡️ N/A | In an action — one-shot call, reactivity does not apply |
stores/product-brokers.js |
69 | const { team } = useAccountBridge() |
➡️ N/A | In an action — one-shot call, reactivity does not apply |
stores/product-brokers.js |
83 | const { team } = useAccountBridge() |
➡️ N/A | In an action — one-shot call, reactivity does not apply |
Additional fixes not original list
| File | Issue | Fix |
|---|---|---|
pages/account/Settings.vue |
team was destructured from useAccountTeamStore() — team is not state on that store, so it was always undefined. The active team lives in useContextStore. This was a silent migration bug: the if (team?.id === teamId) guard never fired, meaning a deleted team would never trigger the fallback to a different team. |
Changed to useContextStore().team so the check works correctly |
cstns
left a comment
There was a problem hiding this comment.
Looking good! I'll approve it today but we should postpone it's release to next week as discussed on slack.
Awesome work!
Description
See details & test plan.
Related Issue(s)
Resolves #6942
Checklist
flowforge.yml?FlowFuse/helmto update ConfigMap TemplateFlowFuse/CloudProjectto update values for Staging/ProductionLabels
area:migrationlabel