Skip to content

Commit

Permalink
wip: fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicole Watts committed Sep 23, 2024
1 parent f8a6341 commit 6fa5ebf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ function handleFocusEvent(
event.target.classList.contains("mafs-graph") &&
state.interactionMode === "mouse"
) {
dispatch(actions.global.changeKeyboardInvitationVibility(true));
dispatch(actions.global.changeKeyboardInvitationVisibility(true));
}
}
}
Expand All @@ -393,7 +393,7 @@ function handleBlurEvent(
dispatch: (action: InteractiveGraphAction) => unknown,
) {
if (state.type === "point" && state.numPoints === "unlimited") {
dispatch(actions.global.changeKeyboardInvitationVibility(false));
dispatch(actions.global.changeKeyboardInvitationVisibility(false));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ export function interactiveGraphReducer(
): InteractiveGraphState {
switch (action.type) {
case REINITIALIZE:
if (
state.type === "point" &&
state.showKeyboardInteractionInvitation
) {
return state;
}
return initializeGraphState(action.params);
case MOVE_POINT_IN_FIGURE:
return doMovePointInFigure(state, action);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,6 @@ export const StatefulMafsGraph = React.forwardRef<
const originalPropsRef = useRef(props);
const latestPropsRef = useLatestRef(props);
useEffect(() => {
if (state.hasBeenInteractedWith) {
return;
}
// This conditional prevents the state from being "reinitialized" right
// after the first render. This is an optimization, but also prevents
// a bug where the graph would be marked "incorrect" during grading
Expand All @@ -136,7 +133,6 @@ export const StatefulMafsGraph = React.forwardRef<
showSides,
latestPropsRef,
startCoords,
state.hasBeenInteractedWith,
]);

// If the graph is static, it always displays the correct answer. This is
Expand Down

0 comments on commit 6fa5ebf

Please sign in to comment.