Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
TamarZanzouri committed Sep 16, 2024
1 parent 3088eb0 commit d132a91
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions app/src/resources/runs/useNotifyAllCommandsQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<TError = Error>(
runId: string | null,
params?: GetRunCommandsParams | null,
Expand All @@ -21,8 +32,19 @@ export function useNotifyAllCommandsQuery<TError = Error>(
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()
Expand Down

0 comments on commit d132a91

Please sign in to comment.