Skip to content

Commit 4ce6ad7

Browse files
authored
Merge pull request #50 from Luc1412/master
Ignore non dispatchable items when refreshing a view
2 parents ce67f6c + 378d8eb commit 4ce6ad7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

discord/ui/view.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,12 +394,15 @@ def refresh(self, components: List[Component]):
394394
if item.is_dispatchable()
395395
}
396396
# fmt: on
397-
children: List[Item] = []
397+
children: List[Item] = [item for item in self.children if not item.is_dispatchable()]
398398
for component in _walk_all_components(components):
399399
try:
400400
older = old_state[(component.type.value, component.custom_id)] # type: ignore
401401
except (KeyError, AttributeError):
402-
children.append(_component_to_item(component))
402+
item = _component_to_item(component)
403+
if not item.is_dispatchable():
404+
continue
405+
children.append(component)
403406
else:
404407
older.refresh_component(component)
405408
children.append(older)

0 commit comments

Comments
 (0)