awacke1 commited on
Commit
a4310db
·
verified ·
1 Parent(s): 439fbe0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -573,14 +573,16 @@ def render_sidebar():
573
  horizontal=True # Make radio horizontal if preferred
574
  )
575
 
576
- # Handle tool change
577
  if selected_tool != current_tool_name:
578
  st.session_state.selected_object = selected_tool
579
  add_action_log(f"Selected tool: {selected_tool}")
580
- # Update JS via sync call
581
- sync(js_code=f"updateSelectedObjectType({json.dumps(selected_tool)});", key=f"update_tool_js_{selected_tool}")
582
- st.rerun() # Rerun to confirm selection visually if needed (might not be necessary)
583
-
 
 
584
 
585
  # --- Action Log ---
586
  st.markdown("---")
 
573
  horizontal=True # Make radio horizontal if preferred
574
  )
575
 
576
+ # Handle tool change
577
  if selected_tool != current_tool_name:
578
  st.session_state.selected_object = selected_tool
579
  add_action_log(f"Selected tool: {selected_tool}")
580
+ # CORRECTED: Use streamlit_js_eval instead of sync
581
+ # This sends the update to JS without needing a return value immediately
582
+ streamlit_js_eval(js_code=f"updateSelectedObjectType({json.dumps(selected_tool)});", key=f"update_tool_js_{selected_tool}")
583
+ # Rerun to potentially update other UI elements if needed, though maybe optional
584
+ # if only JS state needs update for the tool. Let's keep it for now.
585
+ st.rerun()
586
 
587
  # --- Action Log ---
588
  st.markdown("---")