oxidecomputer / oxidecomputer/console

IdP create form is dirty immediately (dev only)

Open
#2,913 2 comments 0 reactions 0 assignees View on GitHub

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.

https://github.com/oxidecomputer/console/blob/5c393b4dea3f525df3f62cf07ae451e391381040/app/forms/idp/create.tsx#L77-L89

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 setValue because 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 the setValue does not help (setValue docs)
Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.