Skip to content

Commit

Permalink
Simplify chicanery
Browse files Browse the repository at this point in the history
  • Loading branch information
GreenAsJade committed Sep 7, 2024
1 parent 1801883 commit 00044c6
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/views/Game/GameLog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,10 @@ export function GameLog({
const [shouldDisplayFullLog, setShouldDisplayFullLog] = React.useState(false);

const { registerTargetItem } = React.useContext(DynamicHelp.Api);
const { ref: autoscoreRef } = {
// this chicanery defends against registerTargetItem being null due to this component _not_ being
// wrapped in OGSHelpProvider, which happens when it is in a Modal.
// TBD: make Modals be inside OGSHelpProvider, so they can have help.
ref: null,
...registerTargetItem?.("autoscore-game-log-entry"),
};

// Defend against the case where we aren't wrapped in a help provider: in a Modal
// TBD: made Modals be able to use the help provider
const autoscoreRef = registerTargetItem?.("autoscore-game-log-entry")?.ref || null;
const game_id = goban_config.game_id as number;

let firstAutoscoringEntryRendered = false;
Expand Down

0 comments on commit 00044c6

Please sign in to comment.