fix: prevent numeric input from resetting to zero on blur without edit#7560
Open
3351163616 wants to merge 1 commit intoAstrBotDevs:masterfrom
Open
fix: prevent numeric input from resetting to zero on blur without edit#75603351163616 wants to merge 1 commit intoAstrBotDevs:masterfrom
3351163616 wants to merge 1 commit intoAstrBotDevs:masterfrom
Conversation
When a numeric input field was focused but not edited, the blur handler called toNumber(null) which returned 0 via parseFloat(null) → NaN → 0. Now we skip emitting the update when numericTemp is null (no edits made).
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider extracting the inline
@blurarrow function into a named method to keep the template simpler and make the blur/update logic easier to unit test and extend later. - If
numericTempis only evernullor a string/number, you could simplify the check by using a stricter comparison (numericTemp !== null) or, alternatively, document thatnumericTempmay beundefinedso the!= nullcheck is clearly intentional.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider extracting the inline `@blur` arrow function into a named method to keep the template simpler and make the blur/update logic easier to unit test and extend later.
- If `numericTemp` is only ever `null` or a string/number, you could simplify the check by using a stricter comparison (`numericTemp !== null`) or, alternatively, document that `numericTemp` may be `undefined` so the `!= null` check is clearly intentional.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the ConfigItemRenderer.vue component to include a null check for numericTemp within the @blur event handler of the numeric text field. This change ensures that emitUpdate is only called when a value has been entered, preventing potential issues with null values being processed. I have no feedback to provide as there were no review comments to evaluate.
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
kb_fusion_top_k,kb_final_top_k) resetting to 0 when focused and blurred without editing@blurhandler inConfigItemRenderer.vuecalledtoNumber(null)whennumericTempwas never set (no edits), andparseFloat(null)→NaN→ fallback to0numericTempisnull(user made no changes), only resetnumericTemptonullTest plan
Summary by Sourcery
Bug Fixes: