fix(settings): include command in add-event dedup key (#2382)

Fixes #2382.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Greg Jackson
2026-08-16 09:49:31 -07:00
committed by Garry Tan
co-authored by Claude Opus 4.6
parent 2be9bd0660
commit 1dbed2c01f
2 changed files with 52 additions and 1 deletions
+3 -1
View File
@@ -171,8 +171,9 @@ case "$ACTION" in
const matchesEntry = (entry) => {
const sameMatcher = (entry.matcher || "") === matcher;
const sameCommand = entry.hooks && entry.hooks[0] && entry.hooks[0].command === cmd;
const sameSource = entry._gstack_source === source;
return sameMatcher && sameSource;
return sameMatcher && (sameSource || sameCommand);
};
let existing = settings.hooks[event].find(matchesEntry);
@@ -184,6 +185,7 @@ case "$ACTION" in
if (existing) {
existing.hooks = [hookEntry];
existing._gstack_source = source;
} else {
const newEntry = { _gstack_source: source, hooks: [hookEntry] };
if (matcher) newEntry.matcher = matcher;