Skip to content

fix: prevent double devbox creation when pressing Enter in interactive form#173

Merged
jrvb-rl merged 1 commit intomainfrom
jrvb/fix-double-devbox-create
Mar 17, 2026
Merged

fix: prevent double devbox creation when pressing Enter in interactive form#173
jrvb-rl merged 1 commit intomainfrom
jrvb/fix-double-devbox-create

Conversation

@jrvb-rl
Copy link
Contributor

@jrvb-rl jrvb-rl commented Mar 16, 2026

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.

@jrvb-rl jrvb-rl requested review from james-rl and ross-rl March 16, 2026 20:50
Copy link
Contributor

@james-rl james-rl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jrvb-rl jrvb-rl force-pushed the jrvb/fix-double-devbox-create branch from c81aa12 to 904c004 Compare March 17, 2026 06:14
…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.
@jrvb-rl jrvb-rl force-pushed the jrvb/fix-double-devbox-create branch from 904c004 to dda69f0 Compare March 17, 2026 06:27
@jrvb-rl jrvb-rl merged commit 23f8a28 into main Mar 17, 2026
15 checks passed
@jrvb-rl jrvb-rl deleted the jrvb/fix-double-devbox-create branch March 17, 2026 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants