oxidecomputer / oxidecomputer/console
IdP create form is dirty immediately (dev only)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 228
- Forks
- 22
- Avg merge
- 19h 42m
- Merged PRs (30d)
- 32
Description
Bug found while working on #2912, but it turns out to happen on main, too. This only happens in dev, so it's very low priority.
This effect is causing the form to become dirty on initial mount, causing a nav confirm when you try to leave the form, even though you haven't done anything. Key facts:
- I know it's that
setValuebecause when I comment it out the problem goes away - This is only true in development, where React's strict mode is running all effects twice, so it's probably some kind of race
- Adding
{ shouldDirty: false }to thesetValuedoes not help (setValuedocs)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in app/forms/idp/create.tsx at lines 77-89 and inspect the effect that calls setValue. Reproduce the form in development with React Strict Mode enabled, then verify that leaving an untouched form no longer triggers a navigation confirmation and that the value still initializes correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100