From 9580898c9725663d223eed65c8901c581a9043f2 Mon Sep 17 00:00:00 2001 From: Soheab <33902984+Soheab@users.noreply.github.com> Date: Thu, 13 Nov 2025 02:02:19 +0100 Subject: [PATCH] Detach view from item when removed --- discord/ui/view.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/discord/ui/view.py b/discord/ui/view.py index 36d95d8a3..826b6a952 100644 --- a/discord/ui/view.py +++ b/discord/ui/view.py @@ -439,6 +439,7 @@ class BaseView: pass else: self._add_count(-item._total_count) + item._update_view(None) return self @@ -448,6 +449,9 @@ class BaseView: This function returns the class instance to allow for fluent-style chaining. """ + for child in self._children: + child._update_view(None) + self._children.clear() self._total_children = 0 return self @@ -744,6 +748,8 @@ class View(BaseView): pass else: self.__weights.remove_item(item) + item._update_view(None) + return self def clear_items(self) -> Self: