Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump the local storage key for saved form values #159

Merged
merged 1 commit into from
May 9, 2024

Conversation

oyamauchi
Copy link
Member

Description

In #158 I changed the constants that identify projects. I didn't
realize this would break the calculator for users who had the old
constants in local storage (as saved form values).

This is the simplest solution: change the local storage key for saved
form values, which will effectively clear the stored values for
everyone, one time.

There's no attempt to migrate the old values. We would have to support
that code indefinitely (unless we eventually cleared storage anyway),
and I don't think there's a ton of value in preserving form prefills.

The old key will still be there in users' local storage; if we want,
we can follow up with a change to delete it.

Test Plan

Before making this change, reproed the problem by manually editing
local storage and changing the RA-calc-form-values value to have the
old constant heat_pump_clothes_dryer in the projects field. Submit
the form and make sure there was an error (trying to read shortLabel
of undefined).

Apply this change, make sure the form is reset to defaults, and
submitting it doesn't cause an error, and results show up.

## Description

In #158 I changed the constants that identify projects. I didn't
realize this would break the calculator for users who had the old
constants in local storage (as saved form values).

This is the simplest solution: change the local storage key for saved
form values, which will effectively clear the stored values for
everyone, one time.

There's no attempt to migrate the old values. We would have to support
that code indefinitely (unless we eventually cleared storage anyway),
and I don't think there's a ton of value in preserving form prefills.

The old key will still be there in users' local storage; if we want,
we can follow up with a change to delete it.

## Test Plan

Before making this change, reproed the problem by manually editing
local storage and changing the `RA-calc-form-values` value to have the
old constant `heat_pump_clothes_dryer` in the `projects` field. Submit
the form and make sure there was an error (trying to read `shortLabel`
of `undefined`).

Apply this change, make sure the form is reset to defaults, and
submitting it doesn't cause an error, and results show up.
Copy link

vercel bot commented May 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
embed-rewiringamerica-org ✅ Ready (Inspect) Visit Preview May 9, 2024 4:26pm

@oyamauchi oyamauchi merged commit 6f0f722 into main May 9, 2024
3 checks passed
@oyamauchi oyamauchi deleted the owen.local-storage branch May 9, 2024 16:34
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.

1 participant