-
Notifications
You must be signed in to change notification settings - Fork 13
Freeze the Create Instance form when submitting, so the user can't make post-submit edits #1893
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
Freeze the Create Instance form when submitting, so the user can't make post-submit edits #1893
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Look great overall, thanks for doing this. I also wondered about how to do a |
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.
Very nice! Not as complicated as I expected.
Not sure about the peer-disabled:text-secondary
thing. @benjaminleonard?
Ooh, there is an |
I think we're okay on the |
oxidecomputer/console@644a45b...b9013a3 * [b9013a33](oxidecomputer/console@b9013a33) oxidecomputer/console#1898 * [fb9e9ca5](oxidecomputer/console@fb9e9ca5) oxidecomputer/console#1904 * [9ae29498](oxidecomputer/console@9ae29498) oxidecomputer/console#1897 * [6b894ceb](oxidecomputer/console@6b894ceb) oxidecomputer/console#1901 * [d80d2e7c](oxidecomputer/console@d80d2e7c) oxidecomputer/console#1886 * [2a7da0fa](oxidecomputer/console@2a7da0fa) bump vite for security fix * [700e2700](oxidecomputer/console@700e2700) oxidecomputer/console#1893
oxidecomputer/console@644a45b...b9013a3 * [b9013a33](oxidecomputer/console@b9013a33) oxidecomputer/console#1898 * [fb9e9ca5](oxidecomputer/console@fb9e9ca5) oxidecomputer/console#1904 * [9ae29498](oxidecomputer/console@9ae29498) oxidecomputer/console#1897 * [6b894ceb](oxidecomputer/console@6b894ceb) oxidecomputer/console#1901 * [d80d2e7c](oxidecomputer/console@d80d2e7c) oxidecomputer/console#1886 * [2a7da0fa](oxidecomputer/console@2a7da0fa) bump vite for security fix * [700e2700](oxidecomputer/console@700e2700) oxidecomputer/console#1893
Fixes #1613
In #1613, we see that it's currently possible for a user to edit the Create Instance form after they hit the submit button, and — as the process can sometimes take a bit of time — that this can create confusion in the user about whether last-second edits will be accepted, and, maybe more problematic, a confusing modal appears asking the user if they want to navigate away from the page.
This PR disables the form fields when the user hits the submit button, so edits can't take place. It also disables the tabs that would otherwise allow the user to switch between instance sources (silo vs. project) and switching between the pre-configured sizes for CPU and storage.
One thing I'm not sure about how to elegantly handle is that we have it setting the
useState
value toisSubmitting
when the form is submitted, but there isn't a way to re-set that tofalse
if something blows up in the process. I suspect there's some sort of event that happens when an error is thrown, but am still looking into that.The only other thing to call out, I think, is that I had to remove a CSS class, which normally affects a selected-but-disabled form field's text color. Note the removal of
peer-disabled:text-secondary
in the code below.With that class present (as it is currently), when the form fields are disabled, the selected option looks like this:

By removing the class, the disabled state for the selected option …


… looks more like the normal state for the selected option:
(with the disabled state (top) having slightly thinner outlines)
I believe this is doing what we want, but know there are other situations where removing that class might not be what we want? "Selected but disabled" is a pretty rare situation, though, so I think this class possibly fine to drop.