Skip to content

Commit

Permalink
Only allow triggering of connect when connection dialog is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-grace committed Dec 3, 2024
1 parent 088a428 commit 1cccda2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/LiveGraphPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import {
import { useCallback, useRef } from "react";
import { FormattedMessage, useIntl } from "react-intl";
import { ConnectionStatus } from "../connect-status-hooks";
import { useConnectionStage } from "../connection-stage-hooks";
import {
ConnectionFlowStep,
useConnectionStage,
} from "../connection-stage-hooks";
import microbitImage from "../images/stylised-microbit-black.svg";
import { useLogging } from "../logging/logging-hooks";
import { tourElClassname } from "../tours";
Expand All @@ -33,7 +36,7 @@ const LiveGraphPanel = ({
showPredictedAction,
disconnectedTextId,
}: LiveGraphPanelProps) => {
const { actions, status, isConnected } = useConnectionStage();
const { actions, status, isConnected, stage } = useConnectionStage();
const parentPortalRef = useRef(null);
const logging = useLogging();
const isReconnecting =
Expand Down Expand Up @@ -71,7 +74,7 @@ const LiveGraphPanel = ({
}, [actions, logging]);
useHotkeys(keyboardShortcuts.disconnect, handleDisconnect, {
...globalShortcutConfig,
enabled: isConnected,
enabled: isConnected && stage.flowStep === ConnectionFlowStep.None,
});
const intl = useIntl();
return (
Expand Down

0 comments on commit 1cccda2

Please sign in to comment.