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

Navigating from classifier, to project home, back to classifier - task component not rendered #2891

Closed
mcbouslog opened this issue Feb 24, 2022 · 8 comments · Fixed by #2895
Labels
bug Something isn't working

Comments

@mcbouslog
Copy link
Contributor

Package

  • lib-classifier

Describe the bug

Task area renders "Task component could not be rendered."

To Reproduce

Steps to reproduce the behavior:

  1. Go to TESS or Beyond Borders
  2. Click on project name to return to project home page
  3. Click on project nav "Classify"
  4. See error

Expected behavior

Classifier loads with tasks.

@mcbouslog mcbouslog added the bug Something isn't working label Feb 24, 2022
@goplayoutside3
Copy link
Contributor

Did a little debugging on this. This only happens when navigating away from and back to the same workflow. On projects with multiple workflows, choosing a new workflow after navigating to the homepage will successfully load the Task Area.

The task components are showing an error because the SubjectStore does not have an active subject, and its resources and queue arrays are both empty.

^^ After that line is called in the ClassifierContainer, the SubjectStore properties I mentioned are empty, and there's no follow up function called to fetch new subjects.

There was a significant refactor of this file in #2793, so I'm going to tag @eatyourgreens here for visibility.

@eatyourgreens
Copy link
Contributor

eatyourgreens commented Feb 25, 2022

Thanks! That's really useful. The classifier store is a global variable, defined in the useStore hook. So it isn't destroyed when the classifier unmounts. That's probably what's causing this: the classifier loads, and useEffect runs on an existing store in the window scope.

I thought resetting the queue would force a refresh from Panoptes, but obviously not. The subjects store doesn't work the way I thought it did.

@eatyourgreens
Copy link
Contributor

I've got some changes to useStore in #2863, so I'll check whether this bug exists on that branch too.

@eatyourgreens
Copy link
Contributor

Global variables can be tricky to debug, but this bug is triggering when the classifier is mounted with store already defined in the window.

@eatyourgreens
Copy link
Contributor

For easier debugging, you can also trigger this bug by toggling 'Cache Panoptes Data' in the dev classifier, which avoids having to rebuild classifier/dist/main.js between changes.

Screen.Recording.2022-02-25.at.07.48.56.mov

@eatyourgreens
Copy link
Contributor

Linking #2141 for context. That's the PR where I added the global store.

@eatyourgreens
Copy link
Contributor

#2895 should fix this. I'm not seeing it happen on I Fancy Cats, in the dev classifier, any more.

@eatyourgreens
Copy link
Contributor

The bug was introduced by if (!workflows.active?.prioritized), which applies the following block to every project that is not HMS NHS or Davy Notebooks. That's a warning to be wary of the logical NOT operator in new code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants