Skip to content

Commit

Permalink
fix: command action resets to first action when PI loads (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisrijsdijk committed May 21, 2024
1 parent da2b820 commit 9648cc4
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/pi/actions/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,22 @@ class PiCommand implements PiAction {
));
}

const id = commandSelect.find("option:selected").val() as string;
const settingsId = this.settings.action.id;

const systemId = systemCommandOptGroup.find("option:selected").val() as string;
const customId = customCommandOptGroup.find("option:selected").val() as string;

let id: string;

if (systemId === settingsId) {
id = systemId;
} else if (customId === settingsId) {
id = customId;
}

if (id == null) {
id = commands[0].id;
}

if (id !== this.settings.action.id) {
this.settings.action.id = id;
Expand Down

0 comments on commit 9648cc4

Please sign in to comment.