Skip to content

Commit

Permalink
Merge pull request #2811 from GreenAsJade/bugfix_help_in_game_log
Browse files Browse the repository at this point in the history
Defend against GameLog being used in a context without help
  • Loading branch information
anoek authored Sep 8, 2024
2 parents e193466 + 00044c6 commit d2c6421
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/views/Game/GameLog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ export function GameLog({
const [shouldDisplayFullLog, setShouldDisplayFullLog] = React.useState(false);

const { registerTargetItem } = React.useContext(DynamicHelp.Api);
const { ref: autoscoreRef } = 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 d2c6421

Please sign in to comment.