[pull] canary from lobehub:canary#362
Merged
Merged
Conversation
… with scope isolation (#15844) * ✨ feat(swr): unified tiered cache provider (localStorage + IndexedDB) with scope isolation Route SWR persistence to a tier chosen centrally by key — IndexedDB for large business entities (messages, topics, tasks, documents, agents), localStorage for small list shells (recents) — instead of stuffing everything into one ~5MB localStorage blob. Partition every tier by identity scope (`${userId}:${workspaceId}`) so users/workspaces sharing an origin never collide, and add a boot hydration gate so local-first data is present before the routed app mounts. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * ♻️ refactor(swr): centralize IndexedDB-tier keys into swrKeys registry with domain:resource naming Introduce src/libs/swr/keys.ts as the single source of truth for SWR cache keys, named uniformly as `<domain>:<resource>` (e.g. message:list, topic:list, task:detail). Migrate the IndexedDB-tier domains (message, topic, agent, group, task, document/page/notebook, brief) off scattered local consts/inline literals onto registry factories, updating call sites, mutate matchers, and tests. The tiered cache provider now routes by `domain:` prefix instead of ad-hoc substrings, and matchDomain() enables refreshing a whole domain at once. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Home InputArea computed isAgentConfigLoading but never passed it to DesktopChatInput, so AgentModeNotice flashed the "model unsupported" warning during hydration. Forward isConfigLoading like every other call site so the notice only appears after config loads. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…15847) Fills the three refactor-critical holes left in the characterization net (LOBE-10377) — exactly the invariants LOBE-10378/10379/10382 will rewrite. - client (streamingExecutor): waiting_for_async_tool leaves the op UNcompleted (no switch case) and emits an undefined complete-signal status (normalize falls through); waiting_for_human completes-for-UI but does NOT drain queue or mark unread (parked != terminal). - gateway (gatewayEventHandler): waiting_for_async_tool park is currently treated as a completed + unread terminal (no pause short-circuit), and shares the `interrupted` reconciliation branch (preserve streamed content vs DB refetch, uiMessages SoT takes precedence). - lifecycle (conversationLifecycle): post-persist summaryTopicTitle fires on the CLIENT path (new-topic OR empty-title gate) and is NOT invoked on the GATEWAY path (early return; title handled server-side). Tests-only; characterization (locks current behavior, incl. suspected gaps with comments). 135 tests pass across the 3 files. Part of LOBE-10376
…rKeys registry (#15848) * ♻️ refactor(swr): migrate session/thread/recent/group-list keys into swrKeys registry Batch 1 of the SWR key centralization: add session/thread/recent keys and group:list to the registry under the domain:resource convention, migrate call sites + mutate matchers, update the localStorage tier patterns (recent:list, group:list), and update tests. Removes the ALL_RECENTS_DRAWER_SWR_PREFIX export in favor of recentKeys.allDrawer. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * ♻️ refactor(swr): version+unify message key, drop isLogin from keys, migrate agent/aiModel/image/video/serverConfig - message: drop `listLegacy`; both stores use the accurate `message:list` key, now carrying MESSAGE_CACHE_VERSION; fix the chat store `refreshMessages` to invalidate the real key via a context matcher (was a dead key, never matched). - keys: remove the redundant `isLogin` arg from all list factories (the app is always authenticated); drop the now-unused isLogin param from useFetchSessions. - migrate agent config/available/search, aiModel, image+video generation, and serverConfig keys into the registry; update call sites, mutate matchers, tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * ♻️ refactor(swr): restore isLogin arg in list keys Re-introduce the isLogin argument across the session/agent/group/recent/brief list key factories and their call sites (incl. useFetchSessions). The key must vary with auth state so login/logout transitions invalidate the cached list instead of serving another user's snapshot. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * 🐛 fix(swr): harden tiered cache flush + scope re-hydration - localStorageProvider: flush both tiers on visibilitychange→hidden (and pagehide) instead of beforeunload. IndexedDB writes are async and can't be awaited on teardown; flushing while the page is still alive (hidden) gives them time to land before unload. - Query: reset the new scope's hydration readiness before reloadScope() (in a layout effect), so the boot gate keeps blocking through the async IDB re-load instead of rendering stale data from a previously-visited scope. - CacheHydrationGate: render the brand logo while gating instead of returning null, keeping the hand-off from the static loading screen seamless. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )