Skip to content

Teams PR 1 — data-farm store + first consumer #7650

Description

@n-lark

PR 1 — data-farm store + first consumer

stores/data-farm/teams.ts, id data-farm-teams.

  • State: byId, order (the user's team list), currentTeamId, membershipByTeamId, loadState.

  • Getters: list, current, get(id), isLoading, isLoaded.

  • Actions: ensureLoaded() (→ getTeams), fetchOne(id) (→ getTeam), setCurrent(id), refreshCurrent() (replaces context.refreshTeam), upsert, remove, applyRealtime, clear.

  • Consolidate the team-list responsibility currently split between context.js and account.js into this store. context.js may keep the derived "current route context" role but should read team data from here rather than owning a second copy.

  • First consumer: migrate the team switcher (primary team-list view) to read list/current via ensureLoaded(), with its skeleton. This is what makes the PR demonstrable.

  • Store created and normalized, with vitest unit tests.

  • getTeams/getTeam/membership fetches moved behind store actions.

  • Team switcher reads the store + skeleton; no direct teamApi there.

  • clear() wired to team switch + logout.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

Status
In Progress

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions