Skip to content

Commit

Permalink
Updated linting and ts errors
Browse files Browse the repository at this point in the history
  • Loading branch information
smb2268 committed May 2, 2024
1 parent 90eb952 commit 3e1ba3e
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 16 deletions.
4 changes: 2 additions & 2 deletions app/src/organisms/QuickTransferFlow/SelectDestLabware.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ export function SelectDestLabware(
): JSX.Element | null {
const { onNext, onBack, exitButtonProps, state, dispatch } = props
const { i18n, t } = useTranslation(['quick_transfer', 'shared'])
if (state.pipette == null) return null
const labwareDisplayCategoryFilters: LabwareFilter[] = [
'all',
'wellPlate',
'reservoir',
]
if (state.pipette?.channels === 1) {
if (state.pipette.channels === 1) {
labwareDisplayCategoryFilters.push('tubeRack')
}
const [selectedCategory, setSelectedCategory] = React.useState<LabwareFilter>(

Check failure on line 46 in app/src/organisms/QuickTransferFlow/SelectDestLabware.tsx

View workflow job for this annotation

GitHub Actions / js checks

React Hook "React.useState" is called conditionally. React Hooks must be called in the exact same order in every component render. Did you accidentally call a React Hook after an early return?

Check failure on line 46 in app/src/organisms/QuickTransferFlow/SelectDestLabware.tsx

View workflow job for this annotation

GitHub Actions / js checks

React Hook "React.useState" is called conditionally. React Hooks must be called in the exact same order in every component render. Did you accidentally call a React Hook after an early return?
'all'
)
if (state.pipette == null) return null
const compatibleLabwareDefinitions = getCompatibleLabwareByCategory(
state.pipette.channels,
selectedCategory
Expand Down
2 changes: 1 addition & 1 deletion app/src/organisms/QuickTransferFlow/SelectDestWells.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function SelectDestWells(props: SelectDestWellsProps): JSX.Element {
type: 'SET_DEST_WELLS',
wells: Object.keys(state.source.wells),
})
} else if (state.destination != 'source' && state.destination != null) {
} else if (state.destination !== 'source' && state.destination != null) {
dispatch({
type: 'SET_DEST_WELLS',
wells: Object.keys(state.destination.wells),
Expand Down
1 change: 0 additions & 1 deletion app/src/organisms/QuickTransferFlow/SelectPipette.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { useInstrumentsQuery } from '@opentrons/react-api-client'
import { getPipetteSpecsV2, RIGHT, LEFT } from '@opentrons/shared-data'
import { SmallButton, LargeButton } from '../../atoms/buttons'
import { ChildNavigation } from '../ChildNavigation'
import { generateCompatibleLabwareForPipette } from './utils'

import type { PipetteData, Mount } from '@opentrons/api-client'
import type {
Expand Down
4 changes: 2 additions & 2 deletions app/src/organisms/QuickTransferFlow/SelectSourceLabware.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ export function SelectSourceLabware(
): JSX.Element | null {
const { onNext, onBack, exitButtonProps, state, dispatch } = props
const { i18n, t } = useTranslation(['quick_transfer', 'shared'])
if (state.pipette == null) return null
const labwareDisplayCategoryFilters: LabwareFilter[] = [
'all',
'wellPlate',
'reservoir',
]
if (state.pipette?.channels === 1) {
if (state.pipette.channels === 1) {
labwareDisplayCategoryFilters.push('tubeRack')
}
const [selectedCategory, setSelectedCategory] = React.useState<LabwareFilter>(

Check failure on line 46 in app/src/organisms/QuickTransferFlow/SelectSourceLabware.tsx

View workflow job for this annotation

GitHub Actions / js checks

React Hook "React.useState" is called conditionally. React Hooks must be called in the exact same order in every component render. Did you accidentally call a React Hook after an early return?

Check failure on line 46 in app/src/organisms/QuickTransferFlow/SelectSourceLabware.tsx

View workflow job for this annotation

GitHub Actions / js checks

React Hook "React.useState" is called conditionally. React Hooks must be called in the exact same order in every component render. Did you accidentally call a React Hook after an early return?
'all'
)
if (state.pipette == null) return null

const compatibleLabwareDefinitions = getCompatibleLabwareByCategory(
state.pipette.channels,
Expand Down
4 changes: 2 additions & 2 deletions app/src/organisms/QuickTransferFlow/VolumeEntry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function VolumeEntry(props: VolumeEntryProps): JSX.Element {
}

const error =
volume != '' &&
volume !== '' &&
(volumeAsNumber < volumeRange.min || volumeAsNumber > volumeRange.max)
? t(`value_out_of_range`, {
min: volumeRange.min,
Expand All @@ -82,7 +82,7 @@ export function VolumeEntry(props: VolumeEntryProps): JSX.Element {
onClickButton={handleClickNext}
secondaryButtonProps={exitButtonProps}
top={SPACING.spacing8}
buttonIsDisabled={error != null || volume == ''}
buttonIsDisabled={error != null || volume === ''}
/>
<Flex
alignSelf={ALIGN_CENTER}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import type { QuickTransferSetupState } from '../types'

describe('getVolumeLimits', () => {
let state: QuickTransferSetupState = {
const state: QuickTransferSetupState = {
pipette: {
liquids: [
{
Expand Down
19 changes: 12 additions & 7 deletions app/src/organisms/QuickTransferFlow/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,20 @@ export function getVolumeLimits(
const maxPipetteVolume = Object.values(state.pipette.liquids)[0].maxVolume
const tipRackVolume = Object.values(state.tipRack.wells)[0].totalLiquidVolume
const sourceLabwareVolume = Math.min(
...state.sourceWells.map(well => state.source.wells[well].totalLiquidVolume)
...state.sourceWells.map(well =>
state.source ? state.source.wells[well].totalLiquidVolume : 0
)
)

const destLabwareVolume = Math.min(
...state.destinationWells.map(well =>
state.destination === 'source'
? state.source.wells[well].totalLiquidVolume
: state.destination.wells[well].totalLiquidVolume
)
...state.destinationWells.map(well => {
{

Check failure on line 161 in app/src/organisms/QuickTransferFlow/utils.ts

View workflow job for this annotation

GitHub Actions / js checks

Nested block is redundant

Check failure on line 161 in app/src/organisms/QuickTransferFlow/utils.ts

View workflow job for this annotation

GitHub Actions / js checks

Nested block is redundant
if (state.source == null || state.destination == null) return 0
return state.destination === 'source'
? state.source.wells[well].totalLiquidVolume
: state.destination.wells[well].totalLiquidVolume
}
})
)
let maxVolume = maxPipetteVolume
if (state.sourceWells.length === state.destinationWells.length) {
Expand Down Expand Up @@ -210,7 +215,7 @@ export function generateCompatibleLabwareForPipette(

const compatibleDefUriList = allLabwareDefinitions.reduce<string[]>(
(acc, definition) => {
if (pipetteSpecs.channels == 1) {
if (pipetteSpecs.channels === 1) {
return [...acc, getLabwareDefURI(definition)]
} else {
const isCompatible = canPipetteUseLabware(pipetteSpecs, definition)
Expand Down

0 comments on commit 3e1ba3e

Please sign in to comment.