Skip to content

Commit

Permalink
Defend against GameLog being used in a context without help
Browse files Browse the repository at this point in the history
  • Loading branch information
GreenAsJade committed Sep 7, 2024
1 parent 247b059 commit 1801883
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/views/Game/GameLog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ export function GameLog({
const [shouldDisplayFullLog, setShouldDisplayFullLog] = React.useState(false);

const { registerTargetItem } = React.useContext(DynamicHelp.Api);
const { ref: autoscoreRef } = registerTargetItem("autoscore-game-log-entry");
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"),
};

const game_id = goban_config.game_id as number;

Expand Down

0 comments on commit 1801883

Please sign in to comment.