Open kotx opened 2 years ago
@mrbbot I still can't get this to work, any tips?
Hey! 👋 Apologies for the delayed reply. Yes, this is intentional. All custom IDs need to be declared at the top level so they're the same across calls. Don't worry if you only use them in your useModal
callback, they'll just get ignored if you don't use them all the time.
export function cmd() {
const selectId = useSelectMenu(...);
const modalId = useModal(() => {
return (
<Message>
<Select id={selectId}>...</Select>
</Message>
);
});
// Ok to ignore selectId here
return <Modal id={modalId}>...</Modal>;
}
That makes sense, thanks! Works now.
Also it turns out I can't put a Select in an Embed, so it was outputting [object Object]
in the Embed instead of the actual Select element. Might be worthwhile to add a check for this if possible?
For example, anything that uses
useCustomId
likeuseSelect
can't be used in auseModal
context. Is this intentional (e.x. a constraint of the Discord API) or an oversight?