fix: resolve RadioButtonSelect array bounds crash and auth dialog navigation#46
Merged
Conversation
…igation - Add bounds checking in RadioButtonSelect to prevent accessing undefined array elements - Add useEffect to ensure activeIndex stays within valid bounds when items array changes - Add validation guards around navigation handlers (up/down arrow keys) - Fix AuthDialog initialAuthIndex calculation to prevent negative values from findIndex - Ensure Enter key works properly on authentication screen Fixes TypeError: Cannot read properties of undefined (reading 'value') that occurred when activeIndex was out of bounds due to dynamic array changes or invalid initialization. Signed-off-by: loheagn <loheagn@icloud.com>
Contributor
Author
|
I try to use Claude Code to fix a bug which I found in my first usage of Qwen Code. I'm not familiar with typescript but this patch seems to fix the bug correctly. Hope this pr helps. |
This was referenced Jul 23, 2025
ranpox
pushed a commit
that referenced
this pull request
Aug 1, 2025
npm run start -- -m model-id -d data/dir
halfaipg
pushed a commit
to AIPowerGrid/grid-code
that referenced
this pull request
Aug 16, 2025
npm run start -- -m model-id -d data/dir
halfaipg
pushed a commit
to AIPowerGrid/grid-code
that referenced
this pull request
Aug 16, 2025
…igation (QwenLM#46) - Add bounds checking in RadioButtonSelect to prevent accessing undefined array elements - Add useEffect to ensure activeIndex stays within valid bounds when items array changes - Add validation guards around navigation handlers (up/down arrow keys) - Fix AuthDialog initialAuthIndex calculation to prevent negative values from findIndex - Ensure Enter key works properly on authentication screen Fixes TypeError: Cannot read properties of undefined (reading 'value') that occurred when activeIndex was out of bounds due to dynamic array changes or invalid initialization. Signed-off-by: loheagn <loheagn@icloud.com> Co-authored-by: linan.loheagn3 <linan.loheagn3@bytedance.com>
xaelistic
pushed a commit
to xaelistic/qwen-code
that referenced
this pull request
Jun 7, 2026
…igation (QwenLM#46) - Add bounds checking in RadioButtonSelect to prevent accessing undefined array elements - Add useEffect to ensure activeIndex stays within valid bounds when items array changes - Add validation guards around navigation handlers (up/down arrow keys) - Fix AuthDialog initialAuthIndex calculation to prevent negative values from findIndex - Ensure Enter key works properly on authentication screen Fixes TypeError: Cannot read properties of undefined (reading 'value') that occurred when activeIndex was out of bounds due to dynamic array changes or invalid initialization. Signed-off-by: loheagn <loheagn@icloud.com> Co-authored-by: linan.loheagn3 <linan.loheagn3@bytedance.com>
xaelistic
pushed a commit
to xaelistic/qwen-code
that referenced
this pull request
Jun 7, 2026
npm run start -- -m model-id -d data/dir
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.
Summary
TypeError: Cannot read properties of undefined (reading 'value')Root Cause Analysis
The bug occurred when:
RadioButtonSelectreceived an invalidinitialIndex(could be -1 fromfindIndex())itemsarray could makeactiveIndexout of boundsitems[activeIndex].valueChanges Made
RadioButtonSelect Component
useEffectto ensureactiveIndexstays within valid bounds whenitemsarray changesuseInputactivation condition\!) and replaced with proper checksAuthDialog Component
initialAuthIndexcalculation usingMath.max(0, findIndex(...))to prevent negative valuesTest Plan
npm run build)npm run lint)npm run typecheck)npm start)Impact
This fix resolves a crash that prevented users from completing authentication setup, making the CLI unusable in certain scenarios. The fix is backward compatible and doesn't change the public API.