Skip to content

Commit

Permalink
#338 avoid traversing children multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
falkoschindler committed Feb 3, 2023
1 parent 9db6daa commit f284f0a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nicegui/updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ async def loop() -> None:
'''Repeatedly updates all elements in the update queue.'''
while True:
elements: Dict[int, 'Element'] = {}
for _, value in update_queue.items():
for id, value in sorted(update_queue.items()): # NOTE: sort by element ID to process parents before children
if id in elements:
continue
element: 'Element' = value[0]
for id in element.collect_descendant_ids():
elements[id] = element.client.elements[id].to_dict()
Expand Down

0 comments on commit f284f0a

Please sign in to comment.