From d76f316bb7258d04efdab0969eaf9055579357cf Mon Sep 17 00:00:00 2001 From: itsMapleLeaf <19603573+itsMapleLeaf@users.noreply.github.com> Date: Wed, 27 Sep 2023 23:15:24 -0500 Subject: [PATCH] ensure action rows handle child interactions --- .changeset/modern-shirts-kneel.md | 5 +++++ packages/reacord/library/core/components/action-row.tsx | 9 +++++++++ 2 files changed, 14 insertions(+) create mode 100644 .changeset/modern-shirts-kneel.md diff --git a/.changeset/modern-shirts-kneel.md b/.changeset/modern-shirts-kneel.md new file mode 100644 index 0000000..04625da --- /dev/null +++ b/.changeset/modern-shirts-kneel.md @@ -0,0 +1,5 @@ +--- +"reacord": patch +--- + +ensure action rows handle child interactions diff --git a/packages/reacord/library/core/components/action-row.tsx b/packages/reacord/library/core/components/action-row.tsx index a30b6c2..bad0f41 100644 --- a/packages/reacord/library/core/components/action-row.tsx +++ b/packages/reacord/library/core/components/action-row.tsx @@ -2,6 +2,7 @@ import type { ReactNode } from "react" import { ReacordElement } from "../../internal/element.js" import type { MessageOptions } from "../../internal/message" import { Node } from "../../internal/node.js" +import type { ComponentInteraction } from "../../internal/interaction.js" /** * Props for an action row @@ -44,4 +45,12 @@ class ActionRowNode extends Node { child.modifyMessageOptions(options) } } + handleComponentInteraction(interaction: ComponentInteraction) { + for (const child of this.children) { + if (child.handleComponentInteraction(interaction)) { + return true + } + } + return false + } }