Skip to content

Add investigation notes and root cause for issue #15618#63

Merged
sfc-gh-lwilby-1 merged 1 commit into
mainfrom
cursor/selectbox-format-func-revert-eb18
Jun 17, 2026
Merged

Add investigation notes and root cause for issue #15618#63
sfc-gh-lwilby-1 merged 1 commit into
mainfrom
cursor/selectbox-format-func-revert-eb18

Conversation

@sfc-gh-lwilby-1

Copy link
Copy Markdown
Contributor

Follow-up to #62 (which was already merged before these changes were pushed).

Adds issues/gh-15618/NOTES.md with the full root-cause analysis and refines the workaround explanation in issues/gh-15618/app.py.

Root cause (confirmed)

The selectbox widget state is correct ("two"), but st.selectbox() returns the default option ("one") to the script. validate_and_sync_value_with_options validates the stored selection by calling the user's format_func on it inside a broad except Exception. The stored value is a deepcopy of an instance of the previous rerun's class object (the script redefines the class each run); a dataclass's class-gated __eq__ makes x[s] raise KeyError, which the broad except treats as "value not in options" and resets to index 0. NamedTuple is immune because it uses value-based tuple.__eq__.

Verified via a headless AppTest matrix and a monkeypatched trace of the validation helper. See NOTES.md for details and a suggested fix direction.

Open in Web Open in Cursor 
Co-authored-by: Laura Wilby <sfc-gh-lwilby-1@users.noreply.github.com>
@sfc-gh-lwilby-1 sfc-gh-lwilby-1 marked this pull request as ready for review June 17, 2026 16:25
@sfc-gh-lwilby-1 sfc-gh-lwilby-1 merged commit ee3495e into main Jun 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants