Repository navigation
fix(tui): set image preview dialog size on mount - #56449
xirothedev wants to merge 7 commits into
Conversation
dialog.setSize and dialog.setCentered write to the dialog store. Calling them in the render body runs a side effect during render. Move both calls into onMount, matching dialog-integration.tsx and dialog-session-list.tsx. Fixes anomalyco#56143
|
The following comment was made by an LLM, it may be inaccurate: |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
There was a problem hiding this comment.
Looks good. In Solid the component body runs only once, so this is a consistency cleanup rather than a behaviour fix. I checked it with a temporary test on the base and on this branch: after dialog.replace(() => <DialogImagePreview … />), the dialog is xlarge and centered right away. The first rendered frame is identical on both, so moving the calls into onMount causes no first-frame flicker. clear() and later replace() calls still reset size and centering. typecheck passes. The only test/component failures are the dialog-shell-output timeouts, which also fail on the base.
Public API: unchanged.
No concerns. The same pattern is still present in the other dialogs listed below; this PR only covers the image preview.
Related: #56136, #56137, #56138, #56139, #56140, #56141, #56142, #56144, #56145
Issue for this PR
Closes #56143
Type of change
What does this PR do?
dialog.setSize("xlarge")anddialog.setCentered(true)write to the dialog store.DialogImagePreviewcalled both in its render body, so opening the image viewer ran store writes during render. Move them intoonMount, the same shapedialog-integration.tsxanddialog-session-list.tsxalready use.export function DialogImagePreview(props: { images: readonly ImagePreviewItem[]; initial: number }) { const dialog = useDialog() ... - dialog.setSize("xlarge") - dialog.setCentered(true) + onMount(() => { + dialog.setSize("xlarge") + dialog.setCentered(true) + })How did you verify your code works?
bun run typecheckinpackages/tuipasses.bun testinpackages/tui: 1492 pass, 2 skip, 0 fail.onMount; the dialog still opens atxlargeand centered, just after mount instead of during render.Screenshots / recordings
Not a visual change.
Checklist
Added by the opencode bot (AI-generated).
Related: #56136, #56137, #56138, #56139, #56140, #56141, #56142, #56144, #56145