Fix QuotaExceededError when adding many AB1/sequencing files (OpenClo… - #755
Open
Red-Skuller wants to merge 1 commit into
Open
Fix QuotaExceededError when adding many AB1/sequencing files (OpenClo…#755Red-Skuller wants to merge 1 commit into
Red-Skuller wants to merge 1 commit into
Conversation
…ning/OpenCloning#82) The raw contents of verification (sequencing) files were persisted in Web Storage (localStorage in v1.3.1, sessionStorage since the monorepo switch) under 'verification-<sequence_id>-<file_name>' keys. Web Storage has a quota of ~5 MB, so submitting ~10+ AB1 files (e.g. 12 files / 3.9 MiB -> ~5.5 MB in base64) threw a QuotaExceededError and the files/alignments silently disappeared. The contents are now kept in a small in-memory store for the duration of the tab session (same lifetime semantics as before, no quota). They are only needed while the tab is open: alignments are rendered from them, they are downloaded and exported to zips from them, and new uploads re-align against them. After a page reload the cloning strategy is loaded from a file or the database again together with its verification files. - add packages/utils/src/utils/verificationFileStore.js (in-memory store, exposed on window.verificationFileStore when running in Cypress, following the existing window.store pattern) - use it in VerificationFileDialog, useStoreEditor, useCloningHistoryLoader, useInitializeApp, thunks (CopySequenceThunk), readNwrite (downloadStateAsZip, loadFilesToVerificationStore; loadFilesToSessionStorage kept as a deprecated alias) and the cloning store reducer - update the cypress component and e2e specs to assert on the in-memory store - add unit tests (verificationFileStore.test.js) and a jsdom component test (VerificationFileDialog.test.jsx) that uploads 12 real ~346 KB AB1 files (~5.5 MB in base64, above the 5 MB Web Storage quota) and verifies all files are stored, downloadable and removable with Web Storage untouched
🦋 Changeset detectedLatest commit: a0d50cb The changes in this PR will be included in the next version bump. This PR includes changesets to release 10 packages
Not sure what this means? Click here to learn what changesets are. [Click here if you're a maintainer who wants to add another changeset to this PR](https://github.com/Red-Skuller/OpenCloning_frontend/new/fix/verification-files-quota-82?filename=.changeset/seven-hairs-fail.md&value=---%0A%22%40opencloning%2Fstore%22%3A%20patch%0A%22%40opencloning%2Fui%22%3A%20patch%0A%22%40opencloning%2Futils%22%3A%20patch%0A---%0A%0AFix%20QuotaExceededError%20when%20adding%20many%20AB1%2Fsequencing%20files%20(OpenClo%E2%80%A6%0A) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix QuotaExceededError when adding many AB1/sequencing files (OpenCloning/OpenCloning#82)
The raw contents of verification (sequencing) files were persisted in Web Storage (localStorage in v1.3.1, sessionStorage since the monorepo switch) under 'verification-<sequence_id>-<file_name>' keys. Web Storage has a quota of ~5 MB, so submitting ~10+ AB1 files (e.g. 12 files / 3.9 MiB -> ~5.5 MB in base64) threw a QuotaExceededError and the files/alignments silently disappeared.
The contents are now kept in a small in-memory store for the duration of the tab session (same lifetime semantics as before, no quota). They are only needed while the tab is open: alignments are rendered from them, they are downloaded and exported to zips from them, and new uploads re-align against them. After a page reload the cloning strategy is loaded from a file or the database again together with its verification files.