Option to clear Snapshot from sessionStorage
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 20.8k
- Forks
- 2.3k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 156
Description
Describe the problem
When using a Snapshot to store <form> <input> values when the user navigates away, there currently is no way of clearing those values from sessionStorage. In fact, the docs contain a warning regarding same.
Avoid returning very large objects from capture — once captured, objects will be retained in memory for the duration of the session, and in extreme cases may be too large to persist to sessionStorage.
After a <form> has successfully been submitted, there is no reason to keep these values in sessionStorage.
Describe the proposed solution
We would need access to a key so we can call sessionStorage.removeItem(key); or some other method of clearing the data from sessionStorage.
Alternatives considered
No response
Importance
nice to have
Additional Information
I'm currently using BeforeNavigate and AfterNavigate to save, restore and clear my own snapshots to avoid this issue.
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 by reading the Snapshot behavior and its sessionStorage documentation, then trace how BeforeNavigate and AfterNavigate save and restore snapshots. Define how callers can identify and clear a stored snapshot after successful form submission, and verify that clearing removes the associated sessionStorage data without breaking navigation restoration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- web-dev
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 43/100