Keep a newly-typed value in a multiple select using a key_generator - #6198
Open
evnchn wants to merge 4 commits into
Open
Keep a newly-typed value in a multiple select using a key_generator#6198evnchn wants to merge 4 commits into
evnchn wants to merge 4 commits into
Conversation
DateInput applied .props('no-parent-event') to the inner QDate, but
Quasar 2.18.5's QDate has no such prop (noParentEvent belongs to the
anchor-props mixin behind QMenu/QTooltip). It was an inert no-op
attribute; removing it changes no behavior (open/close is driven by the
parent QMenu).
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
In a multiple-select with dict options and a key_generator, `_handle_new_value` generates and stores the new option under a fresh key but its return value was discarded, so the raw typed string (not the key) stayed in the resulting value and got filtered out. Capture the generated key into `args`, mirroring the single-select branch. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
6 tasks
falkoschindler
self-requested a review
July 26, 2026 20:37
The test now types a new value into a multiple select and checks what the element ends up holding, mirroring `test_id_generator` above it. Reverting the fix makes it fail on the symptom: the typed value is dropped. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
ui.select({'a':'A'}, multiple=True, new_value_mode='add', key_generator=itertools.count(100)); user selects 'a', then types 'Banana' and presses Enter. QSelect emits [{'value':0,'label':'A'}, 'Banana']. The new option 100:'Banana' is added to options and appears in the dropdown, but the resulting value stays ['a'] -- the just-created chip vanishes from the selection instead of becoming ['a', 100].
Minimal reproduction (
nicegui/elements/select.py:108) — the exact test/script that was run to reproduce it:→
F [100%]Implementation
One-line fix in Select._event_args_to_value multiple branch: capture _handle_new_value's returned key into args[i] (mirrors single-select branch), so a newly-typed value with dict options + key_generator is kept in the selection.
Verification
./nicegui· pylint 10.00/10 · pytest (touched) — all green.Progress