Refactor: Implement shared list helper for Prompt and Workflow editors#1792
Conversation
…per with standardized layout, reordering, and deleting controls
|
Hi there! I checked out this branch and ran the full local validation pipeline defined in
Since all validation checks pass successfully locally, I am unable to reproduce the problem in the local environment. Per our project instructions ("IF YOU CANNOT REPRODUCE THE PROBLEM LOCALLY, DO NOT ATTEMPT TO FIX IT AND DO NOT PUSH ANY COMMITS"), no unverified changes or commits have been pushed. |
|
Rule: scrollable-region-focusable (serious)
|
|
Hi there! I have analyzed the accessibility violations reported in the recent scan and formulated the exact fixes:
Both fixes will be committed and pushed immediately upon workspace recovery! |
Rationale & Key Decisions
This PR addresses layout inconsistencies and missing functional capabilities (specifically, sequential reordering) within the Prompt and Workflow Editors. Previously, both editors implemented duplicate column layouts and button interfaces to manage sequential lists (messages and steps). This led to visual drift, mismatched spacing, and a sub-optimal developer experience where users had to manually modify underlying files to reorder elements.
To resolve this, we made the following key design decisions:
render_shared_listhelper inhelpers.py. The helper strictly manages the visual container structure, spacing, and universal actions (moving up/down, deleting), while accepting a page-specificitem_renderercallback to render custom fields (like prompt optimization inputs or workflow step mappings)._swap_session_keysand_delete_session_keys) that dynamically rewrite and clean up Streamlit session keys, preventing UI state collisions and ensuring clean, immediate state synchronization.Technical Changes
1. Core Helpers (
studio/studio/helpers.py)render_shared_listto handle standardized layout columns (col_widths=[8.5, 1.5]) and control state._swap_session_keysand_delete_session_keysto programmatically move/delete associated widget states upon reordering or deletion.st.rerun()to ensure the UI updates instantly after any list manipulation.2. Prompt Editor Refactor (
studio/studio/pages/1_📝_Prompt_Editor.py)render_shared_listcomponent to manage prompt messages.3. Workflow Editor Refactor (
studio/studio/pages/2_🔄_Workflow_Editor.py)render_shared_listcomponent to manage workflow execution steps.Acceptance Criteria Checklist