fix(desktop): cache external-session catalog per selection so switching sources shows loaded rows instantly - #3905
Open
liuxiaocs7 wants to merge 1 commit into
Conversation
…ng sources shows loaded rows instantly Switching import source (or toggling the archived filter / search) blanked the list and flashed the full-width 'reading external conversations' spinner on every switch, including returning to a source already loaded, because loadCatalog unconditionally reset the catalog and loading flag with no per-selection caching. Cache the last loaded CatalogState per (adapterId, includeArchived, search): a cache hit renders instantly and refreshes in the background instead of blanking; misses keep the spinner. The poll now observes rather than claims the request generation so it can never strand an in-flight load's spinner. Adds source-switching tests (harness now supports multiple adapters). Generated-by: Claude Code
M4n5ter
force-pushed
the
fix/import-tasks-source-switch-loading
branch
from
August 26, 2026 09:58
3d9b5c9 to
fbf120f
Compare
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.
Summary
Switching the import source — or toggling the archived filter / editing the search, and including returning to a source already loaded — blanked the list and flashed the full-width "Reading external conversations…" spinner on every switch, because
loadCatalogunconditionally reset the catalog and loading flag with no per-selection cache.This caches the last loaded
CatalogStateper(adapterId, includeArchived, search): a cache hit renders the rows immediately and refreshes in the background, while a miss keeps the existing spinner. The background import poll now observes the request generation instead of claiming a new one, so it can never strand an in-flight load'scatalogLoadingreset.Fixes #3904
Verification
tscfortsconfig.preload.json,tsconfig.main.json,tsconfig.renderer.json— all clean.biome checkon both changed files — clean.node --test dist/main/__tests__/import-tasks-settings-page.test.js— 19/19 pass (15 existing + 4 new source-switching cases).shows a previously-loaded source instantly with no spinneranddoes not let a stale background refresh overwrite a newer source selection(17/19); restoring the fix returns them to green (19/19).format:check/knip, fullnpm run build, and the cross-workspace suite.tsconfig.storybook.jsonreports one pre-existing, unrelated error (UsageRequestLog.sessionNameinstories/settings/settings-pages.stories.tsx) that exists on the base commit and this PR does not touch.Review focus (UI evidence)
I could not capture a headless screenshot of the Electron window in my environment, so the before/after is shown via the deterministic test output above instead of an image. To see it live: run the desktop app, open Settings → Activity → Import Tasks with ≥2 sources, and switch back and forth — a revisited source now appears instantly with no spinner flash (first-time loads still show the spinner).
AI use
Select exactly one:
Tool(s) and scope: Claude Code (Claude Opus) — root-cause investigation, the per-selection cache implementation, and the added tests. Reviewed and submitted by the human contributor of record; commit carries a
Generated-by: Claude Codetrailer.Checklist
Does this PR entail a change in behavior?