Skip to content

SelectRenderable: setting options to empty array doesn't clear the rendered content #834

@AlexZeitler

Description

@AlexZeitler

Description

SelectRenderable.refreshFrameBuffer() does an early return when options.length === 0 without clearing the frame buffer:

refreshFrameBuffer() {
    if (!this.frameBuffer || this._options.length === 0)
      return;
    // ...
}

This means previously rendered items remain visible on screen after setting options = [].

Steps to reproduce

  1. Create a SelectRenderable and set options to a list with items
  2. Items render correctly
  3. Set options = []
  4. Previous items remain visible

Expected behavior

Setting options = [] should clear the rendered list.

Suggested fix

Clear the frame buffer before the early return:

refreshFrameBuffer() {
    if (!this.frameBuffer || this._options.length === 0) {
        this.frameBuffer?.clear();
        return;
    }
    // ...
}

Workaround

Use a dummy entry instead of an empty array:

this.select.options = [{ name: "", description: "", value: "__none__" }];

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions