@@ -157,13 +157,15 @@ def remove_machine(self, index: int):
157157 @rx .event (temporal = True )
158158 def update_machine (self , index : int , new_machine_index : int ):
159159 self .machines [index ] = Machine .from_index (new_machine_index )
160+ yield
160161 self ._recalculate_all ()
161162
162163 @rx .event (temporal = True )
163164 def update_messages_tier (self , new_tier_index : int ):
164165 if new_tier_index == self .messages_tier_index :
165166 return
166167 self .messages_tier_index = new_tier_index
168+ yield
167169 self ._recalculate_all ()
168170
169171 def _find_tier_for_credits (self , credits : float ) -> dict | None :
@@ -349,9 +351,10 @@ def messages_card() -> rx.Component:
349351 step = 1 ,
350352 on_value_change = lambda new_tier_index : rx .cond (
351353 MachineState .messages_tier_index != new_tier_index ,
352- MachineState .update_messages_tier (new_tier_index ),
354+ MachineState .update_messages_tier (new_tier_index ). throttle ( 150 ) ,
353355 rx .noop (),
354356 ),
357+ on_value_committed = MachineState .update_messages_tier ,
355358 min_steps_between_values = 1 ,
356359 class_name = "w-full max-w-full" ,
357360 ),
@@ -431,9 +434,12 @@ def machine_card(machine: Machine, index: int) -> rx.Component:
431434 min_steps_between_values = 1 ,
432435 on_value_change = lambda new_machine_index : rx .cond (
433436 machine .index != new_machine_index ,
434- MachineState .update_machine (index , new_machine_index ),
437+ MachineState .update_machine (index , new_machine_index ). throttle ( 150 ) ,
435438 rx .noop (),
436439 ),
440+ on_value_committed = lambda new_machine_index : MachineState .update_machine (
441+ index , new_machine_index
442+ ),
437443 class_name = "w-full max-w-full" ,
438444 ),
439445 on_mouse_enter = machine_tooltip_open_cs .set_value (True ),
0 commit comments