Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: Avoid getting stuck in locked state #29768

Merged
merged 8 commits into from
Dec 3, 2024
4 changes: 2 additions & 2 deletions code/addons/test/src/components/TestProviderRender.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export const TestProviderRender: FC<
padding="small"
active={state.watching}
onClick={() => api.setTestProviderWatchMode(state.id, !state.watching)}
disabled={state.crashed || state.running || isEditing}
disabled={state.running || isEditing}
>
<EyeIcon />
</Button>
Expand All @@ -152,7 +152,7 @@ export const TestProviderRender: FC<
variant="ghost"
padding="small"
onClick={() => api.runTestProvider(state.id, { entryId })}
disabled={state.crashed || state.running || isEditing}
disabled={state.running || isEditing}
>
<PlayHollowIcon />
</Button>
Expand Down
3 changes: 3 additions & 0 deletions code/core/src/manager-api/modules/experimental_testmodule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ export const init: ModuleFn<SubAPI, SubState> = ({ store, fullAPI }) => {
invariant(index, 'The index is currently unavailable');
api.updateTestProviderState(id, { running: true });

api.updateTestProviderState(id, { running: true, failed: false, crashed: false });
ndelangen marked this conversation as resolved.
Show resolved Hide resolved

const provider = store.getState().testProviders[id];

const indexUrl = new URL('index.json', window.location.href).toString();
Expand Down Expand Up @@ -152,6 +154,7 @@ export const init: ModuleFn<SubAPI, SubState> = ({ store, fullAPI }) => {
...config,
...initialTestProviderState,
...(state?.testProviders?.[id] || {}),
running: false,
} as TestProviders[0],
]
)
Expand Down
2 changes: 1 addition & 1 deletion code/core/src/manager/components/sidebar/TestingModule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export const TestingModule = ({
onClick={(e: SyntheticEvent) => {
e.stopPropagation();
testProviders
.filter((state) => !state.crashed && !state.running && state.runnable)
.filter((state) => !state.running && state.runnable)
.forEach(({ id }) => api.runTestProvider(id));
}}
disabled={isRunning}
Expand Down
1 change: 0 additions & 1 deletion code/core/src/types/modules/addons.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/naming-convention */
import type { FC, PropsWithChildren, ReactElement, ReactNode } from 'react';

import type { ListItem } from '../../components';
import type { TestProviderConfig, TestingModuleProgressReportProgress } from '../../core-events';
import type { RenderData as RouterData } from '../../router/types';
import type { ThemeVars } from '../../theming/types';
Expand Down
Loading