Skip to content

TUI: dialog-pair.tsx calls dialog.setSize/setCentered during render #56140

Closed as not planned

Description

@Addin

Summary

dialog-pair.tsx calls dialog.setSize("large") and dialog.setCentered(true) during the render body.

Root cause

packages/tui/src/component/dialog-pair.tsx:18-19:

export function DialogPair() {
  const dialog = useDialog()
  ...
  dialog.setSize("large")
  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, @Addin.

    You're right that DialogPair calls dialog.setSize("large") and dialog.setCentered(true) directly in the component body. Both are plain store setters, though. In Solid a component body runs once and isn't tracked, so this pattern doesn't break anything by itself, and several other dialogs do the same. Moving the calls to onMount could even make the first frame render at the default size before resizing.

    To look into this, could you tell us what actually goes wrong when you open the pairing dialog?

    • Your OpenCode version (opencode --version), OS and terminal
    • What you did to open the dialog
    • What you expected and what you saw instead, e.g. wrong size or position, flicker, a warning in the logs, or a crash. A screenshot or log excerpt would help.

    If this came from reading the code and you haven't seen a visible problem, please say so too.

    You can reply here, 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, ordered from most to least likely to be relevant:

  2. Addin commented on Oct 16, 2026

    @Addin
    Author

    Source code review finding. packages/tui/src/component/dialog-pair.tsx:18-19 calls dialog.setSize(large) and dialog.setCentered(true) in the component body, while other dialogs use onMount (dialog-session-list.tsx:194, dialog-integration.tsx:518, dialog-workspaces.tsx:55). No visible problem observed today, but it's a consistency/cleanup issue. Related: #56136-#56139, #56141-#56145.

  3. opencode-agent commented on Oct 16, 2026

    @opencode-agent
    Contributor

    Thanks for clarifying, @Addin. Since nothing goes wrong in practice, we'll treat this as a code cleanup suggestion rather than a bug: making DialogPair (and the other dialogs) consistent in how they set the dialog size and centering.

    One thing to weigh: these calls are plain store setters, and in Solid a component body runs only once and isn't tracked, so calling them there is safe. Moving them to onMount could make the dialog show at the default size for one frame before resizing. Another option would be to pass the size and centering when the dialog is opened. It probably makes sense to decide this once for all the affected dialogs, so the related reports are best looked at together:

    Maintainers will consider it.

  4. neriousy commented on Oct 20, 2026

    @neriousy
    Member

    Thanks for reviewing the code. You confirmed that the pairing dialog has no visible problem and that this is a consistency suggestion, so we're closing it. If an actual failure occurs, 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