diff --git a/app/src/resources/runs/useNotifyAllCommandsQuery.ts b/app/src/resources/runs/useNotifyAllCommandsQuery.ts index d07b77698bc..12bafb21ef3 100644 --- a/app/src/resources/runs/useNotifyAllCommandsQuery.ts +++ b/app/src/resources/runs/useNotifyAllCommandsQuery.ts @@ -3,9 +3,20 @@ import { useAllCommandsQuery } from '@opentrons/react-api-client' import { useNotifyDataReady } from '../useNotifyDataReady' import type { UseQueryResult } from 'react-query' -import type { CommandsData, GetRunCommandsParams } from '@opentrons/api-client' +import type { + CommandsData, + GetRunCommandsParams, + GetCommandsParams, +} from '@opentrons/api-client' import type { QueryOptionsWithPolling } from '../useNotifyDataReady' +const DEFAULT_PAGE_LENGTH = 30 + +export const DEFAULT_PARAMS: GetCommandsParams = { + cursor: null, + pageLength: DEFAULT_PAGE_LENGTH, +} + export function useNotifyAllCommandsQuery( runId: string | null, params?: GetRunCommandsParams | null, @@ -21,8 +32,19 @@ export function useNotifyAllCommandsQuery( topic: 'robot-server/runs/commands_links', options, }) + const nullCheckedParams = params ?? DEFAULT_PARAMS + + const nullCheckedFixitCommands = params?.includeFixitCommands ?? null + const finalizedNullCheckParams = { + ...nullCheckedParams, + includeFixitCommands: nullCheckedFixitCommands, + } - const httpQueryResult = useAllCommandsQuery(runId, params, queryOptionsNotify) + const httpQueryResult = useAllCommandsQuery( + runId, + finalizedNullCheckParams, + queryOptionsNotify + ) if (shouldRefetch) { void httpQueryResult.refetch()