Skip to content

Commit

Permalink
fix(app): poll modules from protocol run module controls
Browse files Browse the repository at this point in the history
  • Loading branch information
smb2268 committed Mar 1, 2024
1 parent 323a2c7 commit f219dc5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ export const ProtocolRunModuleControls = ({
} = usePipetteIsReady()

const moduleRenderInfoForProtocolById = useModuleRenderInfoForProtocolById(
runId
runId,
true
)
const attachedModules = Object.values(moduleRenderInfoForProtocolById).filter(
module => module.attachedModuleMatch != null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit f219dc5

Please sign in to comment.