mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-11-20 15:51:30 +00:00
Detach view from item when removed
This commit is contained in:
@@ -439,6 +439,7 @@ class BaseView:
|
|||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
self._add_count(-item._total_count)
|
self._add_count(-item._total_count)
|
||||||
|
item._update_view(None)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
@@ -448,6 +449,9 @@ class BaseView:
|
|||||||
This function returns the class instance to allow for fluent-style
|
This function returns the class instance to allow for fluent-style
|
||||||
chaining.
|
chaining.
|
||||||
"""
|
"""
|
||||||
|
for child in self._children:
|
||||||
|
child._update_view(None)
|
||||||
|
|
||||||
self._children.clear()
|
self._children.clear()
|
||||||
self._total_children = 0
|
self._total_children = 0
|
||||||
return self
|
return self
|
||||||
@@ -744,6 +748,8 @@ class View(BaseView):
|
|||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
self.__weights.remove_item(item)
|
self.__weights.remove_item(item)
|
||||||
|
item._update_view(None)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def clear_items(self) -> Self:
|
def clear_items(self) -> Self:
|
||||||
|
|||||||
Reference in New Issue
Block a user