department-of-veterans-affairs / va.gov-team

Public resources for building on and in support of VA.gov. Visit complete Knowledge Hub:
https://depo-platform-documentation.scrollhelp.site/index.html
281 stars 201 forks source link

Hard refresh on an "array route" wipes in-progress form #92878

Open nihil2501 opened 2 weeks ago

nihil2501 commented 2 weeks ago

User story(ies)

As a user, if I happen to hard refresh on an array route, it shouldn't wipe out all of the work I've done by overwriting my in-progress form with an empty one.

Steps to reproduce

  1. Navigate to Simple Forms Patterns Examples here: http://localhost:3001/mock-simple-forms-patterns

  2. Sign in

  3. Click "Start application"

    Screenshot 2024-09-13 at 4 42 35 PM
  4. Use dev route component to go to /text-input

    Screenshot 2024-09-13 at 4 43 27 PM
  5. Fill out the required fields there

    Screenshot 2024-09-13 at 4 44 38 PM
  6. Use dev route component to go to /array-multiple-page-builder

    Screenshot 2024-09-13 at 4 45 23 PM
  7. Continue and fill out 1 employer and observe save-in-progress form update that includes data from the two sections we've worked on so far

    Screenshot 2024-09-13 at 4 47 07 PM
  8. Hard refresh and observe save-in-progress form updated to be empty

    Screenshot 2024-09-13 at 4 48 20 PM

Additional details/notes/links

Hard refresh for one of these array pages seems to want on mount to set some form data with a default state so that something else doesn't blow up which then gets auto saved. But setting form state is done wholesale and we haven't pulled down an in progress form into the client form state yet at this point so we replace and autosave everything with emptiness.

Note, the repro doesn't happen immediately if access expired, so either repro quickly or get yourself back to the point right before the issue manually.

Acceptance criteria

Shouldn't wipe out all of the work I've done by overwriting my in-progress form with an empty one.

Point(s) of contact

N/A

What type of issue is this?

How to configure this issue

nihil2501 commented 2 weeks ago

Note: This PR is not a fix for this defect. Indeed, this defect persists when the linked fix is adopted.