Skip to content

raidboss: fix user triggerset order#993

Open
Souma-Sumire wants to merge 2 commits intoOverlayPlugin:mainfrom
Souma-Sumire:0204
Open

raidboss: fix user triggerset order#993
Souma-Sumire wants to merge 2 commits intoOverlayPlugin:mainfrom
Souma-Sumire:0204

Conversation

@Souma-Sumire
Copy link
Collaborator

@github-actions github-actions bot added raidboss /ui/raidboss module needs-review Awaiting review labels Feb 4, 2026
uniqueById.set(triggerSet.id, triggerSet);
}
this.triggerSets = [...noIdList, ...uniqueById.values()];
this.triggerSets = [...uniqueById.values(), ...noIdList];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, this moves the triggers without an ID to the end so that they'll override anything before them?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, Since built-in triggers always have IDs, the current load order is:
[Built-in -> User (w/ ID) -> User (w/o ID)]

However, if we want to respect the user's original file loading order:
[Built-in -> User A (w/ ID) -> User B (w/o ID) -> User C (w/ ID)]

It might be better to do this instead:

    const lastVersionOfId = new Map<string, typeof this.triggerSets[number]>();
    for (const set of this.triggerSets) {
      if (set.id !== undefined) {
        const existing = lastVersionOfId.get(set.id);
        if (existing !== undefined) {
          console.log(
            `Overriding trigger set id '${set.id}' from '${existing.filename}' with '${set.filename}'`,
          );
        }
        lastVersionOfId.set(set.id, set);
      }
    }

    this.triggerSets = this.triggerSets.filter((set) => {
      if (set.id === undefined)
        return true;
      return lastVersionOfId.get(set.id) === set;
    });
    this.triggerSetsById = Object.fromEntries(lastVersionOfId);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll push this version to stay consistent with the original load order.

@github-actions github-actions bot removed the needs-review Awaiting review label Feb 4, 2026
@github-actions github-actions bot added the needs-review Awaiting review label Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-review Awaiting review raidboss /ui/raidboss module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants