fix out-of-bounds active_option crash#132
Merged
maxmarcon merged 1 commit intomaxmarcon:mainfrom Feb 8, 2026
Merged
Conversation
fixes bug where `active_option` index becomes out of bounds when the options list is dynamically updated via `send_update`, causing the component to crash with `KeyError` or `BadMapError` when trying to access `.label` on `nil`. Variant 1: Crash in `already_selected?` Steps to reproduce: 1. Open a LiveSelect component 2. Type a search query that returns multiple options 3. Use arrow keys to navigate to an option towards the end of the list 4. Select that option 5. Re-open or re-focus the same LiveSelect 6. Type a new search query that returns FEWER options than before 7. Use arrow keys to navigate down in this shorter list 8. Type additional characters to narrow the search even MORE (making the list even shorter) 9. Press Enter to select Variant 2: Crash in `new_current_text_after_selection` Steps to reproduce: 1. Open a LiveSelect component 2. Type a search query that returns multiple options 3. Use arrow keys to navigate to an option towards the end of the list 4. Do NOT press Enter yet - keep the option highlighted 5. Type additional characters to filter results 6. Press Enter to select
Contributor
Author
|
@maxmarcon this one has been rearing its head for us for some time now (we are on 1.7.4, but we have sentries from ~ 10 months ago), finally had time to look into it ... hope this helps! |
|
I have also noticed this bug a few times and would love to see a fix! |
|
I'll love to see this fix into the next release, thanks @hernanat |
Owner
|
Thanks @hernanat ! will take a look soon |
Owner
|
Merged and released with version 1.7.5 |
Contributor
Author
|
whoo! thanks! |
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.
fixes bug where
active_optionindex becomes out of bounds when theoptions list is dynamically updated via
send_update, causing thecomponent to crash with
KeyErrororBadMapErrorwhen trying toaccess
.labelonnil.Variant 1: Crash in
already_selected?Steps to reproduce:
Variant 2: Crash in
new_current_text_after_selectionSteps to reproduce: