Skip to content

refactor: convert the footer, user and activity-type stores to setup stores (CM-1565) - #5004

Merged
gaspergrom merged 2 commits into
mainfrom
refactor/CM-1565-setup-stores
Oct 16, 2026
Merged

gaspergrom merged 2 commits into
mainfrom
refactor/CM-1565-setup-stores

Conversation

@gaspergrom

Copy link
Copy Markdown
Contributor

Summary

Converts the footer, user and activity-type stores to Pinia setup stores. The activity-type store moves from JavaScript to TypeScript and reuses ActivityTypes.ts; the cast and marker CM-1531 left in the shared filter are removed, as that marker named this ticket.

  • types starts as { default: {}, custom: {} } instead of {}, so reading it before the first fetch no longer throws.
  • $reset() is not available on setup stores. Nothing calls it.
  • Consumers differ only in import paths.

Closes linuxfoundation/lfx-cdp-insights-ops#265

…es (CM-1565)

Refs linuxfoundation/lfx-cdp-insights-ops#265

Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
Copilot AI balanced review requested due to automatic review settings October 16, 2026 12:42
@cursor

cursor Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Behavior-preserving Pinia refactor with stronger typing; main behavioral nuance is safer default activity-type state before fetch.

Overview
Refactors three Pinia modules from options-style stores (split state / actions files) to setup stores in single TypeScript files, with the same store IDs and public APIs.

The activity-type store is now typed with ActivityTypes, initializes types as { default: {}, custom: {} } (so consumers can read default / custom before the first fetch), and drops the old JS barrel pieces. ActivityTypeFilter no longer casts activityTypeStore.types or references the CM-1565 typing workaround.

Footer and user stores follow the same pattern: ref-backed state and the existing setVisibility / updateDeveloperMode behavior (including localStorage for developer mode). Barrel index files re-export from the new store modules only.

Reviewed by Cursor Bugbot for commit 5b64ac7. Bugbot is set up for automated code reviews on this repo. Configure here.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

Static review found no blocking regressions or consumer compatibility issues; automated checks were not run.

0 open findings

What changed in this PR

Converts three frontend stores to Pinia setup stores while preserving their existing interfaces.

Changes:

  • Consolidates footer and user state and actions into setup stores.
  • Migrates the activity-type store to TypeScript with safe initial state.
  • Removes the filter’s redundant type cast and migration comment.
File Description
frontend/​src/​shared/​modules/​filters/​components/​filterTypes/​ActivityTypeFilter.vue Removes redundant cast and comment.
frontend/​src/​modules/​user/​store/​pinia/​user.store.ts Adds user setup store.
frontend/​src/​modules/​user/​store/​pinia/​state.ts Removes separate user state.
frontend/​src/​modules/​user/​store/​pinia/​index.ts Re-exports user setup store.
frontend/​src/​modules/​user/​store/​pinia/​actions.ts Removes separate user actions.
frontend/​src/​modules/​layout/​pinia/​state.ts Removes separate footer state.
frontend/​src/​modules/​layout/​pinia/​index.ts Re-exports footer setup store.
frontend/​src/​modules/​layout/​pinia/​footer.store.ts Adds footer setup store.
frontend/​src/​modules/​layout/​pinia/​actions.ts Removes separate footer actions.
frontend/​src/​modules/​activity/​store/​type/​state.js Removes JavaScript activity-type state.
frontend/​src/​modules/​activity/​store/​type/​index.ts Adds TypeScript store export.
frontend/​src/​modules/​activity/​store/​type/​index.js Removes JavaScript store definition.
frontend/​src/​modules/​activity/​store/​type/​activity-type.store.ts Adds typed setup store and safe defaults.
frontend/​src/​modules/​activity/​store/​type/​actions.js Removes separate activity-type actions.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
Copilot AI balanced review requested due to automatic review settings October 16, 2026 12:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The refactor preserves consumer compatibility, has no identified reset dependencies, and has no unresolved findings.

0 open findings

🧠 Review effort: Balanced

@gaspergrom
gaspergrom merged commit c6867e3 into main Oct 16, 2026
14 checks passed
@gaspergrom
gaspergrom deleted the refactor/CM-1565-setup-stores branch October 16, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants