File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -91,16 +91,21 @@ def _add_component_from_item(self, item: Item):
91
91
92
92
def _set_components (self , items : list [Item ]):
93
93
self ._underlying .components .clear ()
94
- if not any (isinstance (b , Select ) for b in self .children ):
94
+ for item in items :
95
+ self ._add_component_from_item (item )
96
+
97
+ def _reorder (self ):
98
+ items = self .children
99
+ if not any ([isinstance (b , Select ) for b in self .children ]):
95
100
a , b = [], []
96
101
for i in items :
97
102
if i .priority is None :
98
103
b .append (i )
99
104
else :
100
105
a .append (i )
101
- items = sorted (a , key = lambda b : b .priority ) + b
102
- for item in items :
103
- self ._add_component_from_item ( item )
106
+ items = sorted (a , key = lambda c : c .priority ) + b
107
+ self . children = items
108
+ self ._set_components ( items )
104
109
105
110
def add_item (self , item : Item ) -> Self :
106
111
"""Adds an item to the action row.
@@ -350,7 +355,7 @@ def walk_items(self) -> Iterator[Item]:
350
355
yield from self .children
351
356
352
357
def to_component_dict (self ) -> ActionRowPayload :
353
- self ._set_components ( self . children )
358
+ self ._reorder ( )
354
359
return self ._underlying .to_dict ()
355
360
356
361
@classmethod
You can’t perform that action at this time.
0 commit comments