Skip to content

Commit

Permalink
LCV: fix the sameSubject test
Browse files Browse the repository at this point in the history
Pass `subjectID` so that we can test whether the subject has changed.
  • Loading branch information
eatyourgreens committed Feb 11, 2022
1 parent 93e8697 commit 38d6cf1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,15 @@ class LightCurveViewer extends Component {
}

componentDidUpdate (prevProps) {
const points = this.props.dataPoints
const prevPoints = prevProps.dataPoints
const sameSubject = (points === prevPoints)
const subject = this.props.subjectID
const prevSubject = prevProps.subjectID
const sameSubject = (subject === prevSubject)

const currentTaskKey = (this.props.currentTask && this.props.currentTask.taskKey) || ''
const prevTaskKey = (prevProps.currentTask && prevProps.currentTask.taskKey) || ''
const sameTask = (currentTaskKey === prevTaskKey)

console.log({ sameSubject })
if (!sameSubject) { // Triggers when changing between Subjects
this.clearChart()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export function LightCurveViewerContainer({
onKeyDown={onKeyDown}
setOnPan={setOnPan}
setOnZoom={setOnZoom}
subjectID={subject.id}
toolIndex={activeToolIndex}
/>
)
Expand Down

0 comments on commit 38d6cf1

Please sign in to comment.