Skip to content

Commit fc10d12

Browse files
committed
Add more checks for tests
1 parent 752724c commit fc10d12

File tree

1 file changed

+7
-1
lines changed
  • packages/app/src/app/components/Preview/DevTools/Tests

1 file changed

+7
-1
lines changed

packages/app/src/app/components/Preview/DevTools/Tests/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,10 @@ class Tests extends React.Component<DevToolProps, State> {
384384

385385
this.setState(oldState =>
386386
immer(oldState, state => {
387+
if (!state.files[test.path]) {
388+
return;
389+
}
390+
387391
const existingTest =
388392
state.files[test.path].tests[testName.join('||||')];
389393

@@ -486,7 +490,9 @@ class Tests extends React.Component<DevToolProps, State> {
486490
this.setState(
487491
oldState =>
488492
immer(oldState, state => {
489-
state.files[file.fileName].tests = {};
493+
if (state.files[file.fileName]) {
494+
state.files[file.fileName].tests = {};
495+
}
490496
}),
491497
() => {
492498
dispatch({

0 commit comments

Comments
 (0)