Skip to content

Commit 384de89

Browse files
authored
fix: don't specify a custom_id for ui.Modal (#56)
## Description Using `custom_id` with `ui.Modal` (not low-level modals) should be discouraged, since the modal store is only keyed by `(user_id, custom_id)`, which can quickly result in weird issues/race conditions. The randomly generated ID is pretty much always what you'd want here. ## Relevant Issues See (1.) here: DisnakeDev/disnake#914
1 parent 2b04fad commit 384de89

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

code-samples/interactions/modals/create-tag.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@ def __init__(self):
2424
style=TextInputStyle.paragraph,
2525
),
2626
]
27-
super().__init__(
28-
title="Create Tag",
29-
custom_id="create_tag",
30-
components=components,
31-
)
27+
super().__init__(title="Create Tag", components=components)
3228

3329
# The callback received when the user input is completed.
3430
async def callback(self, inter: disnake.ModalInteraction):

guide/docs/interactions/modals.mdx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,7 @@ class MyModal(disnake.ui.Modal):
6565
style=TextInputStyle.paragraph,
6666
),
6767
]
68-
super().__init__(
69-
title="Create Tag",
70-
custom_id="create_tag",
71-
components=components,
72-
)
68+
super().__init__(title="Create Tag", components=components)
7369

7470
# The callback received when the user input is completed.
7571
async def callback(self, inter: disnake.ModalInteraction):

0 commit comments

Comments
 (0)