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

Project: reduce network requests from the Hero component #1803

Closed
eatyourgreens opened this issue Sep 16, 2020 · 2 comments · Fixed by #1809
Closed

Project: reduce network requests from the Hero component #1803

eatyourgreens opened this issue Sep 16, 2020 · 2 comments · Fixed by #1809
Labels
enhancement New feature or request

Comments

@eatyourgreens
Copy link
Contributor

eatyourgreens commented Sep 16, 2020

Package
app-project

Is your feature request related to a problem? Please describe.
The project Hero component makes API requests for a project's active workflows when it mounts. Linked subject sets are also loaded, even if the project home page doesn't display them.

componentDidMount () {
return this.fetchWorkflows()
}

To see this, try the following with the Network tools open. Look for API requests that fetch workflows and set_member_subjects.

  1. Visit https://frontend.preview.zooniverse.org/projects/zookeeper/galaxy-zoo
  2. Click through to classify.
  3. Click the link back to the project home page.

Describe the solution you'd like
Active workflows should be requested once. The request isn't authenticated, so could be made on the server.

Ideally, subject sets should only be requested by projects that use grouped workflows (but we don't know if workflows are grouped until we've requested them from the API.)

@eatyourgreens eatyourgreens added the enhancement New feature or request label Sep 16, 2020
@srallen
Copy link
Contributor

srallen commented Sep 16, 2020

Another option would be to store a snapshot of the store in localStorage or IndexedDB, check for the existence of this prior to making the request, and load up the snapshot if it exists rather than make the requests. This is the strategy we're planning for the classifier. If we use a snapshot, we can preload via snapshot into the classifier store as well? We would have to make sure the store trees matched between the project app and classifier.

@eatyourgreens
Copy link
Contributor Author

PH-TESS is out of data at the moment, so not loading workflows, but Galaxy Zoo makes four extra requests for subject sets linked to its workflows. It'd be nice to defer those unless a project is actually using subject set selection.
https://fe-project.zooniverse.org/projects/zookeeper/galaxy-zoo

Screenshot of the network tab on the new Galaxy Zoo home page, showing requests for set_member_subjects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants