fix: handle empty input state in Geez numerals demo#11
fix: handle empty input state in Geez numerals demo#11NatnaelMalike wants to merge 1 commit intoBeamSol:mainfrom
Conversation
NatnaelMalike
commented
Jan 2, 2026
- Clear input field properly when all characters are deleted
- Return empty string for zero/empty input in toEthNumber
- Improve input handling to reset state correctly
- Clear input field properly when all characters are deleted - Return empty string for zero/empty input in toEthNumber - Improve input handling to reset state correctly
|
@NatnaelMalike is attempting to deploy a commit to the Beamlak Solomon 's projects Team on Vercel. A member of the Team first needs to authorize it. |
Summary of ChangesHello @NatnaelMalike, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a user experience issue in the Geez numerals demo by refining how empty input states are managed. Previously, deleting all characters might have left a '0' or an invalid conversion displayed. The changes ensure that when the input field is cleared, the demo correctly reflects an empty state, making the interaction smoother and more predictable for users. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request addresses an issue with handling empty input in the Geez numerals demo component. The changes correctly handle clearing the input field by using 0 as an internal state representation for an empty value. The toEthNumber function is updated to return an empty string for 0, and the input component is updated to display an empty string when the state is 0. My review identifies one logic issue where typing '0' into the input field does not update the state correctly, leading to a poor user experience. I've included a suggestion to resolve this.
| if (!isNaN(value) && value >= 1 && value <= 1000000) { | ||
| setInputNumber(value); | ||
| } |
There was a problem hiding this comment.
The current logic prevents the user from setting the input to 0. If a user types 0, parseInt will correctly parse it, but the condition value >= 1 will evaluate to false, and setInputNumber will not be called. This results in the component's state not being updated, and the input field will revert to its previous value on the next render, which is a confusing user experience.
Since 0 is used to represent the empty state in this component, you should allow setInputNumber(0) to be called when the user types 0. This will make the behavior consistent with clearing the input field.
| if (!isNaN(value) && value >= 1 && value <= 1000000) { | |
| setInputNumber(value); | |
| } | |
| if (!isNaN(value) && value >= 0 && value <= 1000000) { | |
| setInputNumber(value); | |
| } |