Skip to content

Commit 3dff006

Browse files
authored
fix(app, api-client): fix response interface for /protocols/{id}/dataFiles (#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`.
1 parent a477f16 commit 3dff006

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

api-client/src/dataFiles/types.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,5 @@ export interface UploadedCsvFileResponse {
1818
}
1919

2020
export interface UploadedCsvFilesResponse {
21-
data: {
22-
files: CsvFileData[]
23-
}
21+
data: CsvFileData[]
2422
}

app/src/organisms/Devices/HistoricalProtocolRun.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function HistoricalProtocolRun(
4444
const [drawerOpen, setDrawerOpen] = React.useState(false)
4545
const { data: protocolFileData } = useAllCsvFilesQuery(run.protocolId ?? '')
4646
const allProtocolDataFiles =
47-
protocolFileData != null ? protocolFileData.data.files : []
47+
protocolFileData != null ? protocolFileData.data : []
4848
const runStatus = run.status
4949
const runDisplayName = formatTimestamp(run.createdAt)
5050
let duration = EMPTY_TIMESTAMP
@@ -89,9 +89,7 @@ export function HistoricalProtocolRun(
8989
>
9090
{protocolName}
9191
</LegacyStyledText>
92-
{enableCsvFile &&
93-
allProtocolDataFiles != null &&
94-
allProtocolDataFiles.length > 0 ? (
92+
{enableCsvFile ? (
9593
<LegacyStyledText
9694
as="p"
9795
width="5%"

app/src/organisms/Devices/HistoricalProtocolRunDrawer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export function HistoricalProtocolRunDrawer(
4949
(a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
5050
)
5151
const { data } = useAllCsvFilesQuery(run.protocolId ?? '')
52-
const allProtocolDataFiles = data != null ? data.data.files : []
52+
const allProtocolDataFiles = data != null ? data.data : []
5353
const uniqueLabwareOffsets = allLabwareOffsets?.filter(
5454
(offset, index, array) => {
5555
return (

0 commit comments

Comments
 (0)