Skip to content

Commit 2184988

Browse files
authored
fix: Blank page on project change - Uncaught TypeError: Cannot read p… (#368)
* fix: Blank page on project change - Uncaught TypeError: Cannot read properties of null (reading 'instanceId') closes Visual-Regression-Tracker/Visual-Regression-Tracker#463 * Update playwright.yml
1 parent 50961b4 commit 2184988

File tree

4 files changed

+39
-44
lines changed

4 files changed

+39
-44
lines changed

.github/workflows/playwright.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
VRT_BRANCHNAME: ${{ github.head_ref || github.ref_name }}
3232
VRT_CIBUILDID: "Github run_id: ${{ github.run_id }}"
3333

34-
- uses: actions/upload-artifact@v3
34+
- uses: actions/upload-artifact@v4
3535
if: always()
3636
with:
3737
name: playwright-report

src/components/TestRunList/BulkOperation.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ export const BulkOperation: React.FunctionComponent = () => {
4747
);
4848

4949
const isMerge: boolean = React.useMemo(
50-
() => !!rows.find((row: GridRowModel) => selectedIds.includes(row.id.toString()))?.model.merge,
50+
() =>
51+
!!rows.find((row: GridRowModel) =>
52+
selectedIds.includes(row.id.toString()),
53+
)?.model.merge,
5154
[selectedIds, rows],
5255
);
5356

@@ -268,7 +271,9 @@ export const BulkOperation: React.FunctionComponent = () => {
268271
onCancel={dismissDialog}
269272
content={
270273
<Typography>
271-
{`Are you sure you want to ${submitButtonText().toLowerCase()} ${selectedRows.length} items?`}
274+
{`Are you sure you want to ${submitButtonText().toLowerCase()} ${
275+
selectedRows.length
276+
} items?`}
272277
</Typography>
273278
}
274279
onSubmit={() => {

src/components/TestRunList/index.tsx

Lines changed: 31 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -156,58 +156,49 @@ const TestRunList: React.FunctionComponent = () => {
156156
}
157157
unsubscribe?.();
158158
};
159-
return apiRef.current.subscribeEvent?.(
159+
return apiRef.current?.subscribeEvent?.(
160160
"stateChange",
161161
() =>
162-
(unsubscribe = apiRef.current.subscribeEvent(
162+
(unsubscribe = apiRef.current?.subscribeEvent(
163163
"stateChange",
164164
handleStateChange,
165165
)),
166166
);
167-
}, [apiRef, apiRef.current.instanceId]);
167+
}, [apiRef, apiRef.current?.instanceId]);
168168

169169
if (selectedBuild) {
170170
return (
171-
<React.Fragment>
172-
<DataGrid
173-
apiRef={apiRef}
174-
rows={testRuns}
175-
columns={columnsDef}
176-
columnVisibilityModel={{
177-
id: false,
178-
}}
179-
pageSizeOptions={[10, 30, 100]}
180-
paginationModel={paginationModel}
181-
onPaginationModelChange={setPaginationModel}
182-
pagination
183-
loading={loading}
184-
slots={{
185-
toolbar: DataGridCustomToolbar,
186-
}}
187-
checkboxSelection
188-
disableColumnSelector
189-
disableColumnMenu
190-
disableRowSelectionOnClick
191-
sortModel={sortModel}
192-
onSortModelChange={(model) => setSortModel(model)}
193-
onRowClick={(param: GridRowParams) => {
194-
navigate(
195-
buildTestRunLocation(
196-
selectedBuild.id,
197-
param.row["id"].toString(),
198-
),
199-
);
200-
}}
201-
/>
202-
</React.Fragment>
171+
<DataGrid
172+
apiRef={apiRef}
173+
rows={testRuns}
174+
columns={columnsDef}
175+
columnVisibilityModel={{
176+
id: false,
177+
}}
178+
pageSizeOptions={[10, 30, 100]}
179+
paginationModel={paginationModel}
180+
onPaginationModelChange={setPaginationModel}
181+
pagination
182+
loading={loading}
183+
slots={{
184+
toolbar: DataGridCustomToolbar,
185+
}}
186+
checkboxSelection
187+
disableColumnSelector
188+
disableColumnMenu
189+
disableRowSelectionOnClick
190+
sortModel={sortModel}
191+
onSortModelChange={(model) => setSortModel(model)}
192+
onRowClick={(param: GridRowParams) => {
193+
navigate(
194+
buildTestRunLocation(selectedBuild.id, param.row["id"].toString()),
195+
);
196+
}}
197+
/>
203198
);
204199
}
205200

206-
return (
207-
<React.Fragment>
208-
<Typography variant="h5">Select build from list</Typography>
209-
</React.Fragment>
210-
);
201+
return <Typography variant="h5">Select build from list</Typography>;
211202
};
212203

213204
export default TestRunList;

vite.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,5 @@ export default defineConfig({
2121

2222
// When false, all CSS will be extracted into a single CSS file.
2323
cssCodeSplit: false,
24-
2524
},
2625
});

0 commit comments

Comments
 (0)