Repository navigation
fix(projects): prefill project name so Create is enabled on load - #10
Merged
Merged
Conversation
The route passed hideHeader to ProjectForm (suppressing its h1) and rendered only the logo in its own header bar, leaving the page with no heading at all — nothing visible saying what the screen is, and no document heading for screen-reader navigation. Render the h1 in the route header next to the logo, separated by a divider, per the issue's preferred option: the heading shares the existing bar instead of stacking a second one.
The Create Project button was disabled the moment /projects/new loaded: name is required, the form validates onChange, and the untouched field showed no validation message — a dead primary button with no explanation. Prefill the name as 'Project N' (N from the loaded project count, store is preloaded in beforeLoad) and focus the field with the text selected, so a first-time visitor can submit immediately or just type over the default. The defaultValues object is memoized once on mount — a stable identity, since ProjectForm resets whenever it changes. Focus + select runs in an effect declared after the reset effect (reset() rewrites the input value, which collapses any earlier selection) and is limited to the create flow (!isEditing) to stay out of the edit dialog's focus management.
This was referenced Aug 6, 2026
MeepCastana
approved these changes
Aug 6, 2026
MeepCastana
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed locally on a combined review branch (all six merged clean, no conflicts). CI green. Approved.
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.
Fixes #3
What
Create Project was disabled on page load with nothing explaining why:
nameis required, the form validatesonChange, and an untouched field shows no error.How
The issue's preferred option (1):
new.tsxpassesdefaultValues={{ name: 'Project N' }}— N from the project count (the store is preloaded in the route'sbeforeLoad). The object is memoized once on mount:ProjectFormresets whenever thedefaultValuesidentity changes, so it must be stable.ProjectFormfocuses the name field with the text selected on mount, create flow only (!isEditing) so the edit dialog's (Radix) focus management is untouched.Two implementation notes for review:
reset()rewrites the input value, which collapses any selection made before it runs (verified: with the order flipped, the caret sits at the end instead of selecting).focus()/select()on the#nameinput rather than RHF'ssetFocus(..., { shouldSelect: true })—setFocussilently did nothing in this form (reproducibly, while manual DOM focus worked). If anyone knows why, happy to switch.Verification
Headless Chromium against the dev server (promo already dismissed):
Project 1, field focused, text fully selected[0, 9], Create enabledMy Film)/editor/…Known interaction, out of scope here: on a first-ever visit the Kubeez welcome promo steals focus, so the field is not focused after dismissing it. That's the promo-over-the-flow problem tracked in #1.
lint✅, projects tests ✅