CarlyneB commited on
Commit
393404f
·
1 Parent(s): 6c7124b

[FIX] app.py: initialize all methods as disabled, let tab2 sync re-activate them

Browse files
Files changed (1) hide show
  1. app.py +5 -8
app.py CHANGED
@@ -110,18 +110,15 @@ if "auto_disabled_methods" not in st.session_state:
110
  st.session_state.auto_disabled_methods = set()
111
  for m in method_order:
112
  if m not in st.session_state.constraints:
113
- primary = [
114
- strip_unit_suffix(r) for r in cost_sliders.get(m, {})
115
- if (m, strip_unit_suffix(r)) not in secondary_resources
116
- ]
117
- all_hidden = bool(primary) and all(r in hidden_resource_names for r in primary)
118
  st.session_state.constraints[m] = {
119
- "active": not all_hidden,
120
  "cap_type": "percent",
121
  "cap_value": 100,
122
  }
123
- if all_hidden:
124
- st.session_state.auto_disabled_methods.add(m)
125
  _expected_methods = set(cost_sliders.keys())
126
  _current_methods = set(st.session_state.get("costs", {}).keys())
127
  if "costs" not in st.session_state or st.session_state.costs == {} or _expected_methods != _current_methods:
 
110
  st.session_state.auto_disabled_methods = set()
111
  for m in method_order:
112
  if m not in st.session_state.constraints:
113
+ # All methods start disabled; tab2 pre-render sync auto-activates each
114
+ # method once all its required resources are available (standard > 0 and
115
+ # hidden resources covered by a custom batch).
 
 
116
  st.session_state.constraints[m] = {
117
+ "active": False,
118
  "cap_type": "percent",
119
  "cap_value": 100,
120
  }
121
+ st.session_state.auto_disabled_methods.add(m)
 
122
  _expected_methods = set(cost_sliders.keys())
123
  _current_methods = set(st.session_state.get("costs", {}).keys())
124
  if "costs" not in st.session_state or st.session_state.costs == {} or _expected_methods != _current_methods: