Skip to content

Commit

Permalink
fix: don't specify a custom_id for ui.Modal (#56)
Browse files Browse the repository at this point in the history
## 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
  • Loading branch information
shiftinv authored Jan 13, 2023
1 parent 2b04fad commit 384de89
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
6 changes: 1 addition & 5 deletions code-samples/interactions/modals/create-tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@ def __init__(self):
style=TextInputStyle.paragraph,
),
]
super().__init__(
title="Create Tag",
custom_id="create_tag",
components=components,
)
super().__init__(title="Create Tag", components=components)

# The callback received when the user input is completed.
async def callback(self, inter: disnake.ModalInteraction):
Expand Down
6 changes: 1 addition & 5 deletions guide/docs/interactions/modals.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,7 @@ class MyModal(disnake.ui.Modal):
style=TextInputStyle.paragraph,
),
]
super().__init__(
title="Create Tag",
custom_id="create_tag",
components=components,
)
super().__init__(title="Create Tag", components=components)

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

0 comments on commit 384de89

Please sign in to comment.