refactor(web): consolidate storage and split root state and app shell into composables - #979
Merged
Conversation
…otification modules
…bar, detail panel and file preview
🦋 Changeset detectedLatest commit: ea4856d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
# Conflicts: # apps/kimi-web/src/App.vue # apps/kimi-web/src/composables/useKimiWebClient.ts
commit: |
# Conflicts: # apps/kimi-web/src/composables/useKimiWebClient.ts
Collaborator
Author
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
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.
Related Issue
N/A — internal refactor; no user-facing behavior change.
Problem
apps/kimi-webhad two large hotspots that made changes risky:useKimiWebClient.ts(~4.5k lines) acted as the global store, API wrapper, storage layer, theme/notification manager, task poller and side-chat host all at once.App.vue(~1.5k lines) held the detail panel, file preview, sidebar layout, page title and auth gate directly.localStorageaccess was inlined across ~8 files with duplicatedtry/catchand no single key registry.sessions,activeSessionId,messagesBySession) were mutated from many places, so "where does this field change?" had no single answer.What changed
Pure structure refactor — no runtime behavior change; the public
useKimiWebClientfacade and component templates are unchanged.storagehelper and route alllocalStorageaccess through it with centralized key constants.useKimiWebClientinto focused client composables (appearance, notification, task polling, model/provider, side chat, workspace) behind the existing facade (useKimiWebClient.ts4529 → 2057 lines).App.vuepage-title, auth gate, sidebar layout, detail panel and file-preview logic into composables (App.vue1563 → 1166 lines; template and style blocks byte-for-byte unchanged).sessions,activeSessionIdandmessagesBySessionmutations through named setters owned by the facade, so each hot field has one mutation entry point.Verified with
typecheck,test(22),buildandoxlint(0 errors) at every step.Checklist
storage-logic.test.tsfor the new storage helper; otherwise pure refactor covered by existing tests.)gen-changesetsskill, or this PR needs no changeset. (Patch on@moonshot-ai/kimi-code;@moonshot-ai/kimi-webis ignored and bundled into the CLI.)gen-docsskill, or this PR needs no doc update. (No user-facing behavior change.)