Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion packages/graphing-solution-set/src/container/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,15 @@ class Root extends React.Component {
}

if (!isEqual(prevProps.marks, marks)) {
this.store.dispatch(changeMarks(marks));
// Don't dispatch marks that have correctness (evaluate mode marks) into the undo history.
// These marks are already handled in render() via the correctnessSet path and bypass the
// Redux store entirely. Dispatching them would pollute the undo history and cause the graph
// to show the correct answer when the user presses undo after returning to gather mode.
const hasCorrectness = marks && marks.find((m) => m.correctness);

if (!hasCorrectness) {
this.store.dispatch(changeMarks(marks));
}
}
}

Expand Down
10 changes: 9 additions & 1 deletion packages/graphing/src/container/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,15 @@ class Root extends React.Component {
}

if (!isEqual(prevProps.marks, marks)) {
this.store.dispatch(changeMarks(marks));
// Don't dispatch marks that have correctness (evaluate mode marks) into the undo history.
// These marks are already handled in render() via the correctnessSet path and bypass the
// Redux store entirely. Dispatching them would pollute the undo history and cause the graph
// to show the correct answer when the user presses undo after returning to gather mode.
const hasCorrectness = marks && marks.find((m) => m.correctness);

if (!hasCorrectness) {
this.store.dispatch(changeMarks(marks));
}
}
}

Expand Down
Loading