split up unlock / accounts / config / shell stores#29162
Merged
chrisnojima-zoom merged 4 commits intonojima/HOTPOT-next-670-clean-2from Apr 20, 2026
Merged
split up unlock / accounts / config / shell stores#29162chrisnojima-zoom merged 4 commits intonojima/HOTPOT-next-670-clean-2from
chrisnojima-zoom merged 4 commits intonojima/HOTPOT-next-670-clean-2from
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors application state by splitting previously config-owned concerns into dedicated stores (unlock-folders + shell), and updates desktop/native init + UI consumers accordingly.
Changes:
- Introduces a new
unlock-foldersZustand store and migrates unlock-folders UI/remote plumbing offconfig. - Introduces a new
shellZustand store (focus/activity, window state, reachability/network status, shell prefs) and migrates multiple consumers offconfig. - Moves “bootstrap configured accounts” loading logic out of the daemon store into shared init, and updates related tests.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| shared/unlock-folders/store.tsx | New unlock-folders Zustand store (devices + paper key error + dispatch). |
| shared/unlock-folders/remote-proxy.desktop.tsx | Uses unlock-folders store instead of config for remote window props. |
| shared/unlock-folders/main2.desktop.tsx | Updates prop typing to use UnlockFolderDevice from new store. |
| shared/unlock-folders/index.desktop.tsx | Updates prop typing to use UnlockFolderDevice from new store. |
| shared/unlock-folders/device-list.desktop.tsx | Updates device typing to UnlockFolderDevice. |
| shared/stores/unlock-folders.tsx | Routes engine rekey refresh events into unlock-folders store. |
| shared/stores/tests/unlock-folders.test.ts | Updates mocks/assertions for the new unlock-folders store entrypoint. |
| shared/stores/tests/shell.test.ts | Adds test coverage for new shell store actions/reset behavior. |
| shared/stores/tests/config.test.ts | Updates config reset tests after moving fields out of config store. |
| shared/stores/shell.tsx | New shell Zustand store (prefs, focus/activity, network/window state). |
| shared/stores/daemon.tsx | Removes daemon-owned “load accounts” helper and hardcoded wait-key constant. |
| shared/stores/convostate.tsx | Switches notification sound lookup from config to shell store. |
| shared/stores/config.tsx | Removes shell/unlock-folders fields + actions; adds dispatch wrapper for gregor reachability updates. |
| shared/settings/display.tsx | Moves forceSmallNav binding from config to shell store. |
| shared/settings/chat.tsx | Moves notification sound binding from config to shell store. |
| shared/settings/advanced.tsx | Moves useNativeFrame + openAtLogin bindings from config to shell store. |
| shared/router-v2/tab-bar.desktop.tsx | Reads forceSmallNav from shell store. |
| shared/router-v2/header/index.desktop.tsx | Reads useNativeFrame and window maximized state from shell store. |
| shared/desktop/renderer/remote-event-handler.desktop.tsx | Routes window state + unlock-folders events to new shell/unlock stores. |
| shared/desktop/renderer/main2.desktop.tsx | Initializes shell prefs (sound, small-nav, open-at-login) on startup. |
| shared/constants/init/shared.tsx | Adds bootstrap account-loading helper and adds a shell subscription for activity changes. |
| shared/constants/init/push-listener.native.tsx | Subscribes to mobileAppState from shell store instead of config. |
| shared/constants/init/index.native.tsx | Migrates platform listeners for app-state + network status to shell store. |
| shared/constants/init/index.desktop.tsx | Migrates desktop platform listeners (focus, reachability, open-at-login persistence) to shell store. |
| shared/constants/chat/common.tsx | Reads appFocused/active from shell store for “actively looking” logic. |
| shared/chat/inbox/use-inbox-search.tsx | Uses mobileAppState from shell store. |
| shared/chat/conversation/normal/container.tsx | Uses active and mobileAppState from shell store. |
| shared/app/index.native.tsx | Sends mobile app state updates to shell store instead of config. |
Comments suppressed due to low confidence (1)
shared/constants/init/shared.tsx:269
markThreadAsRead()is triggered on any change tos.active, including transitions from active → inactive. Sinceactiveis used as a proxy for whether the user is actively looking at the app (seeconstants/chat/common.tsx), marking the thread as read when the user becomes inactive can incorrectly clear unread state while the user is away/idle. Consider gating this to only run when becoming active (and possibly whenappFocusedis true).
useShellState.subscribe((s, old) => {
if (s.active !== old.active) {
const cs = getConvoState(getSelectedConversation())
cs.dispatch.markThreadAsRead()
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.