Repository navigation
fix(input): preserve image previews after session switches - #2988
Merged
bobleer merged 1 commit intoSep 12, 2026
Merged
Conversation
Read the latest composer layout callback from delayed DOM measurements and collapse confirmations so restored image attachments keep the input expanded. Coalesce pending DOM measurement frames and track the observer's stable dependency.
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
Keep pasted image previews visible after switching away from a session and returning. Delayed DOM measurements and collapse confirmations now call the latest layout callback through its existing ref, and repeated DOM mutations coalesce into one pending animation frame.
Type and Areas
Type: Bug fix
Areas: Web UI / chat composer
Motivation / Impact
The DOM observer retained the callback from the composer's initial mount. Depending on its initial state and callback ordering, a later measurement could use an outdated image count, collapse the composer, and hide restored previews. Pasting another image could expand it again and reveal both attachments. Reading the current callback preserves the existing rule that image attachments keep the composer expanded.
Verification
pnpm run check:webpassed, including TypeScript and appearance/theme checks.pnpm --dir src/web-ui run test:run src/flow_chat/components/ChatInputImagePreview.test.tsx src/flow_chat/components/ChatInputDraftRecovery.test.ts src/flow_chat/components/ChatInputWorkspaceStripLayout.test.ts src/flow_chat/store/sessionComposerStore.test.ts src/app/services/sessionSceneLifecycle.test.ts src/flow_chat/services/sessionActivation.test.ts src/flow_chat/services/storeSync.test.ts src/app/stores/sceneStore.test.tspassed: 8 files, 102 tests.pnpm run desktop:devcompleted the Windows debug build and launched the application; the window responded and the local Vite endpoint returned HTTP 200.git diff --checkpassed.Reviewer Notes
This is a frontend scheduling fix. Attachment storage, session draft restoration, and the existing expansion rules are unchanged. No persisted or wire shapes change. Validation covered local Windows development and focused frontend tests; remote workspace, remote control, Peer Device Mode, and Detached Dispatch were not exercised end to end. The intermittent image-paste/session-switch sequence has not been confirmed in a live end-to-end test.
Checklist