From d132a91159c5bee89107e7e01752585554967a78 Mon Sep 17 00:00:00 2001 From: tamarzanzouri Date: Mon, 16 Sep 2024 15:54:13 -0400 Subject: [PATCH] lint --- .../runs/useNotifyAllCommandsQuery.ts | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) 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()