Skip to content

feat: pre-load conversation list before opening ask-bar history drawer#199

Merged
quiet-node merged 1 commit into
mainfrom
feat/preload-askbar-history-drawer
Jun 7, 2026
Merged

feat: pre-load conversation list before opening ask-bar history drawer#199
quiet-node merged 1 commit into
mainfrom
feat/preload-askbar-history-drawer

Conversation

@quiet-node
Copy link
Copy Markdown
Owner

Overview

The ask-bar history drawer animated open before its conversation list had loaded. The drawer animates its height from 0 to auto, and Framer Motion measures auto once at mount. Mounting against an empty list made the open animation finish at the empty height, then snap to the loaded height when the async list arrived. This change pre-loads the list before the drawer mounts, so the animation measures the final height once and grows to it in a single smooth motion.

How it works

  • handleHistoryToggle fetches the conversation list before opening the ask-bar drawer. A new askBarHistory state holds the result: null while loading (the drawer stays unmounted), an array once loaded (seeded into the panel), or 'error' if the pre-load fails.
  • The ask-bar drawer only mounts once askBarHistory is non-null, so its open animation always measures the true final height.
  • HistoryPanel accepts an optional initialConversations prop. When provided, it seeds its state and skips the fetch-on-mount, rendering its final content on the first paint. Searches still re-fetch.
  • On a pre-load failure the drawer still opens and HistoryPanel falls back to fetching itself, surfacing its own load-error state, so the button is never left dead.
  • The chat-mode history dropdown is unaffected: it grows its window through a separate min-height ResizeObserver sync and keeps fetching on its own mount.

Testing

  • New tests cover the pre-load success path, the pre-load error fallback, and HistoryPanel rendering seeded conversations without fetching on mount.
  • bun run test:coverage: 1520 tests pass at 100% coverage across lines, branches, functions, and statements.
  • bun run typecheck, bun run lint:frontend, and bun run build:frontend are clean.

Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
@quiet-node quiet-node merged commit 5ac73e0 into main Jun 7, 2026
3 checks passed
@quiet-node quiet-node deleted the feat/preload-askbar-history-drawer branch June 7, 2026 01:24
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.

1 participant