-
-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove state from stepper input and simplify #1264
Conversation
arduino-ide-extension/src/browser/dialogs/settings/settings-step-input.tsx
Outdated
Show resolved
Hide resolved
@@ -86,34 +52,14 @@ const SettingsStepInput: React.FC<SettingsStepInputProps> = ( | |||
const number = Number(eventValue); | |||
|
|||
if (!isNaN(number) && number !== value) { | |||
let newValue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume the code could return with the function above 👆
if (eventValue === '') {
setSettingsStateValue(0);
return; // <--- this?
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes! sorry I saw this after the fact, I'll add it in when we tackle the scale range question.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried it and it worked. Thank you!
The code looks fine to me overall, but I noticed a little bug. It is possible, via shortcuts (CMD/CTRL + '+', CMD/CTRL + '-'), to exceed the min/max thresholds. For example, if the interface scale is set to Screen.Recording.2022-07-29.at.14.58.06.mov |
Nice rework👍 I tested it by comparing the behavior with RC-9 and it works as before. I also found the bug reported by @AlbyIanna but it was already present before these changes. |
Thanks for catching this, this is actually because at the app level we are not restricting scale, we are only doing it with the stepper. This brings about the UX question: do we want to have a max/min scale. Either way the stepper itself is separate to this issue. |
Motivation
The
settings-step-input.tsx
component contains unnecessarily verbose code and inefficient logic.Change description
Refactors the code, to exclude useState and useEffect hooks.
Acceptance Criteria
The stepper component should function exactly as before (prior to the changes in this PR).
Reviewer checklist