Skip to content

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

Closed as not planned

Description

@Addin

Summary

dialog-image-preview.tsx calls dialog.setSize("xlarge") and dialog.setCentered(true) during the render body.

Root cause

packages/tui/src/component/dialog-image-preview.tsx:21-22:

export function DialogImagePreview(props: { images: readonly ImagePreviewItem[]; initial: number }) {
  const dialog = useDialog()
  ...
  dialog.setSize("xlarge")
  dialog.setCentered(true)  // <-- side effect during render

Suggested fix

Move to onMount.

Activity

  1. opencode-agent commented on Oct 16, 2026

    @opencode-agent
    Contributor

    Thanks for the report! You're right that dialog-image-preview.tsx calls dialog.setSize("xlarge") and dialog.setCentered(true) directly in the component body. In Solid, though, a component function runs only once when it is created, not on every re-render. So these calls are one-time setup writes to the dialog store. The same pattern is used in several other dialogs too.

    To help us decide whether this needs a change, could you tell us what visible problem it causes, if any? For example:

    • Your OpenCode version (opencode --version), OS and terminal
    • What you did to open the image preview
    • What you expected and what you saw instead (e.g. wrong dialog size or position, flicker, a warning or error in the logs), with a screenshot if you can

    You can reply here with the details, or edit the issue. If you edit it, please also leave a comment saying you've updated it so we know when you're done.

    Related issues, all opened alongside this one about the same pattern in other files (none is a duplicate of this one):

  2. Addin commented on Oct 16, 2026

    @Addin
    Author

    Source code review finding. packages/tui/src/component/dialog-image-preview.tsx:21-22 calls dialog.setSize(xlarge) and dialog.setCentered(true) in the component body. Other dialogs use onMount (dialog-session-list.tsx:194, dialog-integration.tsx:518). No visible problem observed today, but it's a consistency issue worth addressing with the related rendering issues (#56136-#56139, #56140-#56142, #56144-#56145).

  3. opencode-agent commented on Oct 16, 2026

    @opencode-agent
    Contributor

    Thanks for clarifying! Since there's no visible problem, I'll treat this as a code-consistency improvement rather than a bug: set the dialog size and centering in onMount (as dialog-session-list.tsx and dialog-integration.tsx already do) instead of directly in the component body. In Solid the component body runs only once, so the current calls behave the same in practice, but making them consistent is a fair cleanup. Maintainers will consider it, most likely together with the sibling issues for the other dialogs that use the same pattern:

  4. neriousy commented on Oct 20, 2026

    @neriousy
    Member

    Thanks for reviewing the code. You confirmed that no visible problem occurs in image preview, so we're closing this consistency request. If you encounter an actual failure, please share the steps and impact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions