Skip to content

Commit

Permalink
Catch workflow ID errors in the classifier
Browse files Browse the repository at this point in the history
Allow workflow ID and subject set ID to be set after the classifier has mounted.
  • Loading branch information
eatyourgreens committed Jan 21, 2021
1 parent a04f6fe commit ede735e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/lib-classifier/src/components/Classifier/Classifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,25 @@ export default class Classifier extends React.Component {
this.classifierStore.setOnAddToCollection(onAddToCollection)
this.classifierStore.classifications.setOnComplete(onCompleteClassification)
this.classifierStore.setOnToggleFavourite(onToggleFavourite)
this.classifierStore.workflows.selectWorkflow(workflowID, subjectSetID)
if (workflowID) {
this.classifierStore.workflows.selectWorkflow(workflowID, subjectSetID)
}
}

componentDidUpdate (prevProps) {
const { authClient, project } = this.props
const { authClient, project, subjectSetID, workflowID } = this.props
if (project.id !== prevProps.project.id) {
this.setProject(project)
}

if (workflowID !== prevProps.workflowID) {
this.classifierStore.workflows.selectWorkflow(workflowID, subjectSetID)
}

if (subjectSetID !== prevProps.subjectSetID) {
this.classifierStore.workflows.selectWorkflow(workflowID, subjectSetID)
}

if (authClient) {
this.classifierStore.userProjectPreferences.checkForUser()
}
Expand Down

0 comments on commit ede735e

Please sign in to comment.