fix: prevent double devbox creation when pressing Enter in interactive form#173
Merged
fix: prevent double devbox creation when pressing Enter in interactive form#173
Conversation
james-rl
approved these changes
Mar 16, 2026
Contributor
james-rl
left a comment
There was a problem hiding this comment.
This fix looks ok and it's best to land it. That said, I think it's somewhat atypical to have forms use a global handler instead of their own delegate function.
More detail in comments.
c81aa12 to
904c004
Compare
…e form The DevboxCreatePage had two overlapping Enter key handlers that both called handleCreate(): the FormTextInput's onSubmit prop and a global catch-all in the parent useInput handler. Since ink doesn't stop event propagation between useInput hooks, pressing Enter on any text field fired both handlers, creating two devboxes. Replaced the global catch-all with a specific handler for the create button field, and removed onSubmit from text inputs. Now only the create button and Ctrl+S trigger devbox creation, while each special field (metadata, gateways, etc.) retains its own Enter handler. Bonus: Fixed some unrelated build errors.
904c004 to
dda69f0
Compare
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.
The DevboxCreatePage had two overlapping Enter key handlers that both
called handleCreate(): the FormTextInput's onSubmit prop and a global
catch-all in the parent useInput handler. Since ink doesn't stop event
propagation between useInput hooks, pressing Enter on any text field
fired both handlers, creating two devboxes.
Replaced the global catch-all with a specific handler for the create
button field, and removed onSubmit from text inputs. Now only the
create button and Ctrl+S trigger devbox creation, while each special
field (metadata, gateways, etc.) retains its own Enter handler.
Bonus: Fixed some unrelated build errors.