From f219dc5c85a7e1ba80deaa357685d7324f16fc91 Mon Sep 17 00:00:00 2001 From: smb2268 Date: Fri, 1 Mar 2024 15:13:03 -0500 Subject: [PATCH] fix(app): poll modules from protocol run module controls fix RQA-2419 --- .../Devices/ProtocolRun/ProtocolRunModuleControls.tsx | 3 ++- .../hooks/useModuleRenderInfoForProtocolById.ts | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/src/organisms/Devices/ProtocolRun/ProtocolRunModuleControls.tsx b/app/src/organisms/Devices/ProtocolRun/ProtocolRunModuleControls.tsx index bf18a5ac5de..ecf04ba81e1 100644 --- a/app/src/organisms/Devices/ProtocolRun/ProtocolRunModuleControls.tsx +++ b/app/src/organisms/Devices/ProtocolRun/ProtocolRunModuleControls.tsx @@ -82,7 +82,8 @@ export const ProtocolRunModuleControls = ({ } = usePipetteIsReady() const moduleRenderInfoForProtocolById = useModuleRenderInfoForProtocolById( - runId + runId, + true ) const attachedModules = Object.values(moduleRenderInfoForProtocolById).filter( module => module.attachedModuleMatch != null diff --git a/app/src/organisms/Devices/hooks/useModuleRenderInfoForProtocolById.ts b/app/src/organisms/Devices/hooks/useModuleRenderInfoForProtocolById.ts index 73a879d32e4..35bfe0d0a87 100644 --- a/app/src/organisms/Devices/hooks/useModuleRenderInfoForProtocolById.ts +++ b/app/src/organisms/Devices/hooks/useModuleRenderInfoForProtocolById.ts @@ -28,18 +28,21 @@ export interface ModuleRenderInfoById { [moduleId: string]: ModuleRenderInfoForProtocol } -const DECK_CONFIG_REFETCH_INTERVAL = 5000 +const REFETCH_INTERVAL_5000_MS = 5000 export function useModuleRenderInfoForProtocolById( - runId: string + runId: string, + pollModules?: boolean ): ModuleRenderInfoById { const robotProtocolAnalysis = useMostRecentCompletedAnalysis(runId) const { data: deckConfig } = useDeckConfigurationQuery({ - refetchInterval: DECK_CONFIG_REFETCH_INTERVAL, + refetchInterval: REFETCH_INTERVAL_5000_MS, }) const storedProtocolAnalysis = useStoredProtocolAnalysis(runId) const protocolAnalysis = robotProtocolAnalysis ?? storedProtocolAnalysis - const attachedModules = useAttachedModules() + const attachedModules = useAttachedModules({ + refetchInterval: pollModules ? REFETCH_INTERVAL_5000_MS : false, + }) if (protocolAnalysis == null) return {} const deckDef = getDeckDefFromRobotType(