Skip to content

[BUG] Deleting a macro whose commands QuickAdd couldn't read gives no warning, unlike the folder case #1612

Description

@chhoumann

Found while fixing #1593.

Delete is the one irreversible action in the settings list, and the two container types are treated asymmetrically.

A folder whose choices value could not be read gets a specific warning before it is deleted (choiceService.ts:249-257):

QuickAdd couldn't read this folder's contents. Deleting it also deletes whatever is still stored under it in data.json.

A macro gets only the generic line (choiceService.ts:273):

Deleting this choice will also delete its macro commands.

That sentence is true but says nothing about the case that matters: macro.commands holds something QuickAdd could not read ({"0": {...}}, a string, a number). Since #1593 the macro builder tells the user about that state and refuses to overwrite it - and then the delete dialog, the one place it is about to be destroyed for good, says nothing.

Suggested shape

Reuse the predicate the builder already reads, so the two surfaces cannot disagree - exactly the argument the folder case makes:

isMacro && isUnreadableCommandList((choice as IMacroChoice).macro?.commands)
    ? "QuickAdd couldn't read this macro's commands. Deleting it also deletes whatever is still stored under it in data.json."
    : ...

(isUnreadableCommandList lives in src/utils/macroUtils.ts.)

Also worth covering the case where the whole macro object is unreadable, which #1593 added handling for in the builder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions