Use walk_children within remove_view

This commit is contained in:
Michael
2026-02-22 23:47:15 +02:00
committed by GitHub
parent 91f958cbac
commit 38d5d8e47a

View File

@@ -913,14 +913,14 @@ class ViewStore:
if message_id is not None and not is_fully_dynamic: if message_id is not None and not is_fully_dynamic:
self._synced_message_views[message_id] = view self._synced_message_views[message_id] = view
def remove_view(self, view: View) -> None: def remove_view(self, view: BaseView) -> None:
if view.__discord_ui_modal__: if view.__discord_ui_modal__:
self._modals.pop(view.custom_id, None) # type: ignore self._modals.pop(view.custom_id, None) # type: ignore
return return
dispatch_info = self._views.get(view._cache_key) dispatch_info = self._views.get(view._cache_key)
if dispatch_info: if dispatch_info:
for item in view._children: for item in view.walk_children():
if isinstance(item, DynamicItem): if isinstance(item, DynamicItem):
pattern = item.__discord_ui_compiled_template__ pattern = item.__discord_ui_compiled_template__
self._dynamic_items.pop(pattern, None) self._dynamic_items.pop(pattern, None)