fix(ai): contain long SQL preview overflow - #1960
Closed
openai0229 wants to merge 3 commits into
Closed
openai0229 wants to merge 3 commits into
openai0229 wants to merge 3 commits into
Conversation
Contributor
Author
|
Stopping this fix at maintainer request. The unmerged SQLPreview and message-scroll changes are being discarded, and the earlier merged PR #1907 will be reverted separately. |
This was referenced Jul 23, 2026
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.
Related issue
Closes #1905
Summary
The earlier Markdown and
SQLPreviewcontainment fixes were necessary but did not explain the packaged JCEF symptom where the entire conversation shifted horizontally. Exactsqlfences still require the localSQLPreviewoverride because@chat2db/ui1.45.3 ignoreswrapand preserves intrinsic-width highlighted code.The remaining cross-boundary path was AI bottom-follow: a sentinel called
scrollIntoView(). That API considers the inline axis and every scrollable ancestor, whileoverflow: hiddencontainers remain programmatically scrollable. A long SQL response could therefore leave the SQL preview correctly contained yet still move the message list or an outer hidden scroller horizontally.This revision removes the sentinel and centralizes bottom-follow, message anchoring, and alignment correction on the message-list element through
scrollTo({ top, left: 0 }). Existing horizontal offset is reset before smooth vertical movement, unexpected manual offsets are normalized, and the AI root usesoverflow: clipwithoverflow: hiddenas the compatibility fallback. The SQLPreview containment and local highlighter override remain in place because they solve the separate intrinsic-width leak.Affected surfaces
Verification
yarn test:ai-message-scroll- passed; forbids AI-pagescrollIntoView, direct message-containerscrollToand directscrollTopwrites, and locks all three automatic paths to the vertical helper.yarn test:ai-markdown-code- passed.yarn test:sql-preview-layout- passed.--max-warnings=0- passed.git diff --check- passed.yarn build:web:community --app_version=5.3.1- passed twice, with a final rebuild after the independent review adjustment; Webpack compiled successfully.5.3.1,ai-markdown-sql-code-block, and theoverflow: clipguard.dist.zipuses the release-script-compatible singledist/root and passesunzip -t.dist.zipSHA-256:e1620a41cbb26bab55231072bc07dec78c0cb3b311a631202f19912adb1d6383.Risk and compatibility
SQLPreviewcallers keep the same props and defaults. AI smooth vertical positioning is preserved, but horizontal offset is now always zeroed before it begins.Reviewer map
chat2db-community-client/src/blocks/AI/messageListScroll.ts, then the three call sites insrc/blocks/AI/index.tsx. Reviewsrc/components/SQLPreview/style.tsseparately for the intrinsic-width containment layer.SQLPreview.Contributor declaration
AI assistance: Codex performed the multi-frame root-cause analysis, traced the SQL/highlighter and message-scroll paths, implemented the scoped SQL containment and axis-scoped scrolling changes, added the regression contracts, and ran the reported checks. The maintainer supplied and reviewed the packaged desktop failures.