-
Notifications
You must be signed in to change notification settings - Fork 69
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
Update ActionForm to support enter key press #2935
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2935 +/- ##
==========================================
- Coverage 80.41% 80.27% -0.15%
==========================================
Files 1504 1504
Lines 48743 48751 +8
Branches 6074 6077 +3
==========================================
- Hits 39197 39134 -63
- Misses 9426 9433 +7
- Partials 120 184 +64
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 27 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
if (onExecuteFailed) { | ||
// Restore the form values on failure to avoid clearing, only if lastTypedValues exists | ||
if (lastTypedValues) { | ||
action.form.setValues(lastTypedValues); |
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.
Will the form value be cleared/ changed if the execution failed?
setSubmitting(true); | ||
try { | ||
// Store current form values before execution | ||
setLastTypedValues(action.form.values); |
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.
lastTypedValues
doesn't have to be a react state. Can be achieved by using a local variable
setLastTypedValues(action.form.values); | |
const lastTypedValues = action.form.values | |
... | |
action.form.setValues(lastTypedValues) |
|
||
// Handle the Enter key submission | ||
const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => { | ||
if (event.key === "Enter" && !submitting) { |
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.
Could consider adding an unit test
This PR is to update the ActionForm so that the user can press the Enter key to submit a form rather than having to click the 'Sign In' button to log in.
This is to fix this CycleCloud bug: https://msazure.visualstudio.com/CycleCloud/_workitems/edit/29267683/
There is no corresponding CycleCloud PR for this change