Skip to content

Commit

Permalink
fix(app, api-client): fix response interface for /protocols/{id}/data…
Browse files Browse the repository at this point in the history
…Files (#15848)

There was an error in the client's expected response interface from
`/protocols/{id}/dataFiles`, causing the app to error when expanding
`HistoricalProtocolRunDrawer`. This PR fixes that response interface and
the implicated endpoint's implementation in `HistoricalProtocolRun` and
`HistoricalProtocolRunDrawer`.
  • Loading branch information
ncdiehl11 authored Jul 31, 2024
1 parent a477f16 commit 3dff006
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
4 changes: 1 addition & 3 deletions api-client/src/dataFiles/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,5 @@ export interface UploadedCsvFileResponse {
}

export interface UploadedCsvFilesResponse {
data: {
files: CsvFileData[]
}
data: CsvFileData[]
}
6 changes: 2 additions & 4 deletions app/src/organisms/Devices/HistoricalProtocolRun.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function HistoricalProtocolRun(
const [drawerOpen, setDrawerOpen] = React.useState(false)
const { data: protocolFileData } = useAllCsvFilesQuery(run.protocolId ?? '')
const allProtocolDataFiles =
protocolFileData != null ? protocolFileData.data.files : []
protocolFileData != null ? protocolFileData.data : []
const runStatus = run.status
const runDisplayName = formatTimestamp(run.createdAt)
let duration = EMPTY_TIMESTAMP
Expand Down Expand Up @@ -89,9 +89,7 @@ export function HistoricalProtocolRun(
>
{protocolName}
</LegacyStyledText>
{enableCsvFile &&
allProtocolDataFiles != null &&
allProtocolDataFiles.length > 0 ? (
{enableCsvFile ? (
<LegacyStyledText
as="p"
width="5%"
Expand Down
2 changes: 1 addition & 1 deletion app/src/organisms/Devices/HistoricalProtocolRunDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function HistoricalProtocolRunDrawer(
(a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
)
const { data } = useAllCsvFilesQuery(run.protocolId ?? '')
const allProtocolDataFiles = data != null ? data.data.files : []
const allProtocolDataFiles = data != null ? data.data : []
const uniqueLabwareOffsets = allLabwareOffsets?.filter(
(offset, index, array) => {
return (
Expand Down

0 comments on commit 3dff006

Please sign in to comment.