Skip to content

WIP: pull out of store 1#29074

Open
chrisnojima-zoom wants to merge 21 commits intonojima/HOTPOT-next-670-cleanfrom
nojima/ZCLIENT-pull-out-of-store-1
Open

WIP: pull out of store 1#29074
chrisnojima-zoom wants to merge 21 commits intonojima/HOTPOT-next-670-cleanfrom
nojima/ZCLIENT-pull-out-of-store-1

Conversation

@chrisnojima-zoom
Copy link
Contributor

Thinning out stores for non global/cross-screen stuff

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR continues the “zustand-store-pruning” effort by shrinking several Keybase Zustand stores (notably signup, settings-email, and settings-password) and moving screen-owned RPC orchestration and transient form state into route params, component state, and new hooks.

Changes:

  • Added a new pruning skill (zustand-store-pruning) plus reference docs/checklists to guide a stacked cleanup series.
  • Refactored signup flow to rely on route params + local component state (and new useRequestAutoInvite) instead of storing username/invite/signup errors globally.
  • Pruned settings-email/settings-password stores to retain only shared/notification-backed state; moved add-email and password-submit flows into component hooks and updated tests accordingly.

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
skill/zustand-store-pruning/references/store-checklist.md Adds a running checklist for the stacked store-pruning series.
skill/zustand-store-pruning/references/keybase-examples.md Adds concrete examples/heuristics for what to keep global vs move local/route.
skill/zustand-store-pruning/agents/openai.yaml Registers a “Zustand Store Pruning” agent configuration.
skill/zustand-store-pruning/SKILL.md Documents the refactor workflow/rules for pruning Zustand stores safely.
shared/stores/tests/signup.test.ts Updates tests to match the slimmer signup store API.
shared/stores/tests/settings-password.test.ts Updates tests to reflect settings-password store only caching randomPW.
shared/stores/tests/settings-email.test.ts Updates tests to match removal of add-email orchestration from the store.
shared/stores/signup.tsx Removes screen-local signup orchestration/state; keeps only device name + verified-email staging.
shared/stores/settings-password.tsx Removes UI/RPC orchestration; keeps only cached randomPW + notification update.
shared/stores/settings-email.tsx Removes add-email form/RPC orchestration; keeps email map + banner state + edit actions.
shared/signup/username.tsx Moves username validation/RPC to component state and passes invite/username via route params.
shared/signup/use-request-auto-invite.ts New hook to fetch invite code and navigate into signup with params (replacing store action).
shared/signup/email.tsx Uses new useAddEmail hook instead of store-owned add-email state/RPC.
shared/signup/device-name.tsx Moves device-name validation + signup RPC into the screen, using route params for username/invite.
shared/settings/password.tsx Adds useSubmitNewPassword hook and moves PGP state fetch + password submit out of the store.
shared/settings/logout.tsx Switches to useSubmitNewPassword and local PGP state loading.
shared/settings/advanced.tsx Moves remember-passphrase RPC/state out of the store and into component-local state.
shared/settings/account/use-add-email.tsx New hook that owns add-email validation, RPC, waiting, and error state.
shared/settings/account/index.tsx Removes call sites for now-removed password-store loadRememberPassword.
shared/settings/account/add-modals.tsx Converts email-add modal to use useAddEmail instead of store-owned add-email flow.
shared/provision/username-or-email.tsx Switches signup entry to use useRequestAutoInvite hook.
shared/people/todo.tsx Removes dependency on removed settings-email.addingEmail field.
shared/login/signup/error.tsx Converts signup error screen to read error details from route params instead of signup store.
shared/login/relogin/container.tsx Switches “create account” entry to useRequestAutoInvite.
shared/login/recover-password/password.tsx Updates UpdatePassword usage to match new props shape.
shared/login/join-or-login.tsx Switches “create account” entry to useRequestAutoInvite.
Comments suppressed due to low confidence (1)

shared/signup/username.tsx:108

  • onContinue can still fire while an RPC is in-flight (e.g., via Enter key), because it only checks disabled and disabled doesn’t incorporate props.waiting. This can lead to duplicate signupCheckUsernameAvailable calls and multiple navigations. Consider treating waiting as a disabling condition (and early-returning in onContinue) so the handler is a no-op while props.waiting is true.
  const onContinue = () => {
    if (disabled) {
      return
    }
    onChangeUsername(usernameTrimmed) // maybe trim the input
    props.onContinue(usernameTrimmed)
  }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

3 participants