-
Notifications
You must be signed in to change notification settings - Fork 2
Jobs SharedWorker #851
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
Jobs SharedWorker #851
Conversation
@@ -0,0 +1,58 @@ | |||
import '../../../../uniprotkb/components/__mocks__/mockApi'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small typo in name of file suported => supported
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it's been tested on its own test deployment URL, but maybe merge this in a morning, just in case we need to revert anything quickly.
Note for reviewer
To view the
SharedWorker
within chrome visit chrome://inspect/#workersPurpose
A bug has been reported that duplicate job creation can occur upon job submission. This PR addresses that issue by having a single SharedWorker used across all instances of the uniprot website within a single browser. This is useful because:
Note that we are now explicitly blocking the submission/viewing of jobs from mobile devices (we previously simply removed the links to these areas of the website). Now there will be explicit pages and messages to ask the user to switch desktop or laptop for this functionality.
Approach
IndexedDB
is the source of truth. The whole state flows directly from this. All interaction with IndexedDB is delegated to the worker.SharedWorker
will always be running, if supported.IndexedDB
and return the complete state afterwards.SharedWorker
using objects of this shape:useSupportsJobs
custom hook created to determine support.IfSupportsJobs
used in main routing logic to wrap job-related routes. Async download logic also updated to handle this case.Testing
Created and updated.
Checklist