Skip to content

fix: restore cached network sidebars immediately - #10

Merged
itz4blitz merged 1 commit into
itz4blitz:mainfrom
vbmithr:fix/network-sidebar-cache
Oct 17, 2026
Merged

itz4blitz merged 1 commit into
itz4blitz:mainfrom
vbmithr:fix/network-sidebar-cache

Conversation

@vbmithr

@vbmithr vbmithr commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Switching away from Signal or another network discarded its sidebar, so returning showed “Getting your … chats…” and waited for the 150 ms event debounce before rereading the local daemon.

Keep each network's home in memory for the GUI session. Returning restores chats and expanded sections immediately, then refreshes from chatd in the background. Explicit navigation skips the debounce; background event bursts still coalesce. First visits still need a local read. Outstanding reads are invalidated when leaving a home, and leaving a sublist restores the root's loading readiness.

Rebased onto upstream main at 7ac7c74 after #8 merged, addressing the requested review changes. Keep #8's initial Discord loading guard and its regression tests, alongside this PR's switch_network and cache tests. Preserve both the first-load/DM-order documentation and the session-cache paragraph. This is a single focused commit. Slack workspace trees and Teams channel trees retain their existing separate loading behavior.

Validation:

  • All eleven GUI home model tests pass on the rebased branch, covering both Discord arrival order and cached navigation/folds/sublist readiness/stale-read invalidation.
  • git diff --check passes.
  • Previous CI passed on macOS, Linux, and Windows; updated CI must run on this rebased head.
  • The user reported the installed sidebar cache working before rebasing. No interactive Wayland validation was performed after rebasing.

@itz4blitz itz4blitz left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The sidebar cache looks right: stale reads are dropped with the epoch check, Slack and Teams trees stay on their existing loading path, and macOS, Linux, and Windows CI are green.

This cannot merge as-is. The branch is behind current main and conflicts in two places after #8:

  • crates/tinyclient/src/gui/sidebar/home.rs — keep #8's discord() guard (if !home.loaded_once { return Vec::new(); }) and its Discord regression tests, and keep this PR's switch_network plus the cache tests.
  • docs/design/polish/02-discord-slack.md — keep both #8's first-load / DM-order paragraph and this PR's session-cache paragraph.

Please rebase onto main and resolve those two files that way.

@itz4blitz itz4blitz mentioned this pull request Oct 17, 2026
2 tasks
Keep network homes and their folds across navigation, then refresh from
chatd in the background. Skip the event debounce on explicit navigation
and invalidate outstanding reads before saving a home. Restore the root
loading state when leaving a sublist so cached empty homes remain ready.

Document the session cache and cover navigation, folds, and stale reads
with regression tests. All eleven GUI home model tests pass.

Co-Authored-By: GPT-6 <noreply@openai.com>
@vbmithr
vbmithr force-pushed the fix/network-sidebar-cache branch from 592de3d to 76afb30 Compare October 17, 2026 15:51

@itz4blitz itz4blitz left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The rebase does what the last review asked. discord() still returns nothing until loaded_once, the Discord order tests are still here, and switch_network plus the session-cache paragraph sit beside them. Leaving a home bumps the epoch before the home is saved, so a read that started earlier cannot overwrite the restored sidebar, and a same-network click does not bump it. Slack and Teams still load through their own trees.

Approving. I'll merge once macOS, Linux, and Windows finish green on 76afb30.

@itz4blitz

Copy link
Copy Markdown
Owner

Approved on 76afb30. Windows failed info_mute_pins_files_emoji_threads_and_a_scheduled_send_ask_slack_once_each (left: 0, right: 1, "one reply after the last read") in crates/chatd/tests/slack.rs. The same assertion failed on #18, which does not touch that test or the sidebar, so this looks like the existing Windows flake rather than the rebase. Linux and macOS are still running. I'll rerun Windows once this workflow finishes, and merge if that run is green.

@itz4blitz
itz4blitz merged commit 83ca5a2 into itz4blitz:main Oct 17, 2026
5 of 6 checks passed
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.

2 participants