zooniverse / front-end-monorepo

A rebuild of the front-end for zooniverse.org
https://www.zooniverse.org
Apache License 2.0
104 stars 29 forks source link

Error switching to different workflow from classification in progress #2809

Closed mcbouslog closed 2 years ago

mcbouslog commented 2 years ago

Package

Describe the bug

Application error. Appears to be per TasksConnector line 27. Changing to const latest = subject?.stepHistory?.latest (adding optional chaining to stepHistory) appears to fix the issue. Not sure how/why subject is defined but stepHistory isn't, thereby creating the issue.

To Reproduce

Steps to reproduce the behavior:

  1. Go to https://www.zooniverse.org/projects/humphrydavy/davy-notebooks-project?demo=true
  2. Click on a workflow
  3. Draw a line and add a test transcription (make sure demo mode enabled)
  4. Click the project name to return to the project home page
  5. Click on a different workflow

Expected behavior

Loads different workflow.

Additional context

I'm only seeing the bug on Davy Notebooks, not seeing the bug on HMS NHS or Corresponding with Quakers

mcbouslog commented 2 years ago

Possible fix in progress - https://github.com/zooniverse/front-end-monorepo/compare/fix-2809?expand=1, will open PR asap

eatyourgreens commented 2 years ago

@mcbouslog Snapshots can't contain models. They have to be pure snapshots.

eatyourgreens commented 2 years ago

Hard to debug on the live site, but I'm seeing an error in a snapshot processor somewhere.

https://www.zooniverse.org/projects/humphrydavy/davy-notebooks-project/classify/workflow/20178?demo=true

'newSnapshot' is read-only error in the console after loading the classifier store.
eatyourgreens commented 2 years ago

It's hard to tell in the minified source, but this might be the line that's crashing, when the stored snapshot contains drawing marks (or is this specific to transcription tasks?) https://github.com/zooniverse/front-end-monorepo/blob/4027e642cd1c1b55e172b8634c1bd2867472ecee/packages/lib-classifier/src/plugins/drawingTools/models/marks/Mark/Mark.js#L36

EDIT: editing to add that drawing and transcription task annotations are stored as something like task.tool.marks, which is part of the store.workflowSteps model and is persisted in session storage. Other task annotations are stored in store.classifications (I think), which is not persisted.

eatyourgreens commented 2 years ago

I can reproduce the bug live on Davy Notebooks, but not with the transcription task on my staging/testing project. 🤔 https://frontend.preview.zooniverse.org/projects/eatyourgreens/-project-testing-ground/classify/workflow/3506?env=staging&demo=true

eatyourgreens commented 2 years ago

@mcbouslog I can recommend using #2793 for debugging. It adds better console log messages when the store hydrates from a snapshot.

eatyourgreens commented 2 years ago

Fixed in #2813, I think. I'm not seeing this bug when I run Davy Notebooks locally on that branch.

Weird that this bug is specific to Davy Notebooks. I wonder if it is triggered by using many workflows that are all clones of the same step and task structure? Drawing task annotations are stored in store.workflowSteps, in the transcription task model.

eatyourgreens commented 2 years ago

Following on from that comment, should we document the classifier store structure to help in debugging?