@@ -73,11 +73,12 @@ def register_tab_table_callbacks(table_id) -> None:
73
73
Output (table_id , "data" ),
74
74
Output (table_id , "style_data_conditional" ),
75
75
Input (f"{ table_id } -weight-store" , "data" ),
76
+ Input ("all-tabs" , "value" ),
76
77
State (table_id , "data" ),
77
- prevent_initial_call = True ,
78
+ prevent_initial_call = "initial_duplicate" ,
78
79
)
79
80
def update_table_scores (
80
- stored_weights : dict [str , float ], table_data : list [dict ]
81
+ stored_weights : dict [str , float ], tabs_value : str , table_data : list [dict ]
81
82
) -> list [dict ]:
82
83
"""
83
84
Update scores table score and rankings when data store updates.
@@ -86,6 +87,8 @@ def update_table_scores(
86
87
----------
87
88
stored_weights
88
89
Stored weight values for `table_id`.
90
+ tabs_value
91
+ Selected tab value (unused; triggers recompute on tab change).
89
92
table_data
90
93
Data from `table_id` to be updated.
91
94
@@ -157,12 +160,16 @@ def register_benchmark_to_category_callback(
157
160
@callback (
158
161
Output (category_table_id , "data" , allow_duplicate = True ),
159
162
Output (category_table_id , "style_data_conditional" , allow_duplicate = True ),
160
- Input (benchmark_table_id , "data" ),
163
+ Input (f"{ benchmark_table_id } -weight-store" , "data" ),
164
+ Input ("all-tabs" , "value" ),
165
+ State (benchmark_table_id , "data" ),
161
166
State (category_table_id , "data" ),
162
167
State (f"{ category_table_id } -weight-store" , "data" ),
163
168
prevent_initial_call = "initial_duplicate" ,
164
169
)
165
170
def update_category_from_benchmark (
171
+ benchmark_weights : dict [str , float ] | None ,
172
+ tabs_value : str ,
166
173
benchmark_data : list [dict ],
167
174
category_data : list [dict ],
168
175
category_weights : dict [str , float ] | None ,
@@ -172,8 +179,12 @@ def update_category_from_benchmark(
172
179
173
180
Parameters
174
181
----------
182
+ benchmark_weights
183
+ Metric weight mapping for the benchmark table.
184
+ tabs_value
185
+ Selected tab value (unused; triggers recompute on tab switch).
175
186
benchmark_data
176
- Rows from the benchmark table containing per-MLIP scores .
187
+ Rows from the benchmark table containing metric columns and Score .
177
188
category_data
178
189
Current rows for the category summary table.
179
190
category_weights
@@ -184,11 +195,14 @@ def update_category_from_benchmark(
184
195
list[dict]
185
196
Updated category table data and style tuple.
186
197
"""
187
- if not benchmark_data or not category_data :
198
+ # Only handle metric-weight updates; ignore tab-change mounts/renders
199
+ if ctx .triggered_id != f"{ benchmark_table_id } -weight-store" :
188
200
raise PreventUpdate
189
201
190
- # Map MLIP -> Score from benchmark table
191
- benchmark_scores = {row ["MLIP" ]: row .get ("Score" ) for row in benchmark_data }
202
+ # Compute MLIP -> Score using latest metric weights for deterministic update
203
+ b_weights = benchmark_weights if benchmark_weights else {}
204
+ recomputed = calc_scores ([row .copy () for row in benchmark_data ], b_weights )
205
+ benchmark_scores = {row ["MLIP" ]: row .get ("Score" ) for row in recomputed }
192
206
193
207
# Inject into the appropriate column for each MLIP
194
208
for row in category_data :
0 commit comments