feat: pre-load conversation list before opening ask-bar history drawer#199
Merged
Conversation
Signed-off-by: Logan Nguyen <lg.131.dev@gmail.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 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.
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 measuresautoonce 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
handleHistoryTogglefetches the conversation list before opening the ask-bar drawer. A newaskBarHistorystate holds the result:nullwhile loading (the drawer stays unmounted), an array once loaded (seeded into the panel), or'error'if the pre-load fails.askBarHistoryis non-null, so its open animation always measures the true final height.HistoryPanelaccepts an optionalinitialConversationsprop. When provided, it seeds its state and skips the fetch-on-mount, rendering its final content on the first paint. Searches still re-fetch.HistoryPanelfalls back to fetching itself, surfacing its own load-error state, so the button is never left dead.Testing
HistoryPanelrendering 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, andbun run build:frontendare clean.