Skip to content

fix(tui): set image preview dialog size on mount - #56449

Open
xirothedev wants to merge 7 commits into
anomalyco:devfrom
The-Resonance-Team:fix/tui-dialog-image-preview-on-mount
Open

xirothedev wants to merge 7 commits into
anomalyco:devfrom
The-Resonance-Team:fix/tui-dialog-image-preview-on-mount

Conversation

@xirothedev

@xirothedev xirothedev commented Oct 17, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #56143

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

dialog.setSize("xlarge") and dialog.setCentered(true) write to the dialog store. DialogImagePreview called both in its render body, so opening the image viewer ran store writes during render. Move them into onMount, the same shape dialog-integration.tsx and dialog-session-list.tsx already 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 typecheck in packages/tui passes.
  • bun test in packages/tui: 1492 pass, 2 skip, 0 fail.
  • The change only moves two store writes from the render body into onMount; the dialog still opens at xlarge and centered, just after mount instead of during render.

Screenshots / recordings

Not a visual change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Related: #56136, #56137, #56138, #56139, #56140, #56141, #56142, #56144, #56145

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
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Oct 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Oct 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@xirothedev
xirothedev marked this pull request as ready for review October 17, 2026 17:38

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

This branch has not been deployed

No deployments
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.

TUI: dialog-image-preview.tsx calls dialog.setSize/setCentered during render

1 participant