Skip to content

Commit

Permalink
fix: fix ActionRowWrapper#editWhere() editing unmatched entries
Browse files Browse the repository at this point in the history
  • Loading branch information
Amgelo563 committed Jan 19, 2024
1 parent 5f7abad commit dec24e5
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions packages/framework/src/discord/ActionRowWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,14 @@ export class ActionRowWrapper<ComponentData extends ActionRowComponentData> {
callback: ComponentEditCallback<ComponentData>,
many = true,
): this {
let appliableComponents = this.components.filter((component) =>
where(component),
);
if (!many) {
appliableComponents = appliableComponents.length
? [appliableComponents[0]]
: [];
}
for (const [index, component] of appliableComponents.entries()) {
this.components[index] = callback(component);
for (const component of this.components) {
if (where(component)) {
const index = this.components.indexOf(component);
this.components[index] = callback(component);
if (!many) break;
}
}

return this;
}

Expand Down

0 comments on commit dec24e5

Please sign in to comment.