Skip to content

TUI: plugin/api.tsx calls dialog.setSize/setCentered during render #56145

Closed as not planned

Description

@Addin

Summary

plugin/api.tsx calls dialog.setSize() and dialog.setCentered() during render in the plugin dialog API set() method.

Root cause

packages/tui/src/plugin/api.tsx:338-339:

set(options) {
  dialog.setSize(options.size ?? "medium")
  dialog.setCentered(options.centered ?? false)
  ...
}

Suggested fix

Move dialog.setSize()/dialog.setCentered() calls out of the render path into onMount or an effect.

Activity

  1. opencode-agent commented on Oct 16, 2026

    @opencode-agent
    Contributor

    Thanks for the report! Before we can act on it, we need a concrete, user-visible problem.

    api.ui.dialog.set() in packages/tui/src/plugin/api.tsx is an ordinary method that plugins call when they decide to, for example from a command handler. It doesn't run during any component's render. A plugin could call it while rendering, but that would be the plugin's choice, not something this file forces. onMount and effects only exist inside components, so they don't apply to this API object.

    If you did run into an actual problem, could you describe it briefly in your own words?

    • Your OpenCode version (opencode --version), OS and terminal
    • The plugin code, or the steps, that trigger it
    • What you expected, and what happened instead (wrong dialog size or position, a warning, flicker, an error, etc.), with any error message or a screenshot

    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 you're done.

    Related issues, ordered from most to least likely to be relevant:

  2. Addin commented on Oct 16, 2026

    @Addin
    Author

    Thank you for the correction. Looking more carefully at :

    set(options) {
      dialog.setSize(options.size ?? "medium")
      dialog.setCentered(options.centered ?? false)
      ...
    }

    You're correct - this is called from the plugin API's method, which plugins invoke from command handlers, not during render. I misread the code context. and are plain store setters, and calling them from (which is invoked by plugins on user action) is perfectly fine.

    I withdraw this issue (#56145) as it's based on an incorrect reading of when is invoked.

  3. Addin commented on Oct 16, 2026

    @Addin
    Author

    Thank you for the correction. Looking more carefully at packages/tui/src/plugin/api.tsx:338-339:

    set(options) {
      dialog.setSize(options.size ?? "medium")
      dialog.setCentered(options.centered ?? false)
      ...
    }

    You're correct - this is called from the plugin API's set() method, which plugins invoke from command handlers, not during render. dialog.setSize() and dialog.setCentered() are plain store setters, and calling them from set() (invoked by plugins on user action) is perfectly fine.

    I withdraw this issue (#56145) as it's based on an incorrect reading of when set() is invoked.

  4. opencode-agent commented on Oct 16, 2026

    @opencode-agent
    Contributor

    Thanks for checking and following up! Since there's no user-visible problem here, this issue will be closed automatically. You're welcome to close it yourself sooner.

    When you look at the related issues you opened (#56137–#56144), a short note on each one about what you actually saw going wrong would help, such as a wrong dialog size, flicker or a warning. A note like that makes them much easier to act on than findings from reading the code alone. If you run into an actual dialog-sizing bug, feel free to open a new issue with your version, the steps to trigger it, and what you expected versus what happened.

  5. opencode-agent commented on Oct 19, 2026

    @opencode-agent
    Contributor

    Closing this as not planned, since you withdrew it. As you confirmed, api.ui.dialog.set() in packages/tui/src/plugin/api.tsx is only called from plugin code, not during render, so nothing needs to change. Thanks for checking again! If you hit a real dialog-sizing problem in v2, please open a new issue with your version, the steps to trigger it, and what you expected versus what happened.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions