Skip to content

[bug]: jsonConfig - fileSelector with delete, delete buttons vanish if no file is selected #3541

Description

@Garfonso

No existing issues.

  • There is no existing issue for my problem.

Describe the bug

Delete buttons vanish, see logs & screenshots.

To Reproduce

  1. jsonConfig with fileSelector and "delete": true, and "default": "" Example:
        "_cardsSelector": {
          "type": "fileSelector",
          objectID: "lovelace.%INSTANCE%",
          "upload": "/cards/",
          "pattern": "/cards/**",
          "refresh": true,
          "withFolder": true,
          "delete": true,
          "default": "",
          "sm": 12,
          "md": 6,
          "lg": 4
        },
  1. "kein" will be selected by default -> open dropdown, already no delete buttons
  2. select a file -> open dropdown, see delete buttons (even on "kein", should also be removed)
  3. select "kein" again -> open dropdown -> delete buttons gone again.

Expected behavior

if delete is true, delete buttons should always show in the dropdown and no delete button should show for "kein". It should not matter at all what file is selected.

Screenshots & Logfiles

Delete buttons are present -> I can delete everything (including "kein", this should maybe be repaired..? Or maybe this bug stems from a try to not show delete on "kein"? -> anyway -> this is ok, delete button there)
Image

Now select "kein" and open the dropdown again:
Image
No delete button for any file anymore... so to delete a file I must select a file (and if I then delete that file, admin crashes, see the other bug ;-))

Admin adapter version

7.9.10

js-controller version

7.2.2

Node version

22.23.1

Operating system

Garuda

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    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