Skip to content

Commit 843bf05

Browse files
committed
Update testRun.context.tsx
1 parent f07ed35 commit 843bf05

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

src/contexts/testRun.context.tsx

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { testRunService } from "../services";
44

55
interface IRequestAction {
66
type: "request";
7-
payload?: undefined;
87
}
98

109
interface IGetAction {
@@ -17,11 +16,6 @@ interface ISelectAction {
1716
payload?: string;
1817
}
1918

20-
interface IIndexAction {
21-
type: "index";
22-
payload?: string;
23-
}
24-
2519
interface IDeleteAction {
2620
type: "delete";
2721
payload: Array<string>;
@@ -49,7 +43,6 @@ interface IRejectAction {
4943

5044
type IAction =
5145
| IRequestAction
52-
| IIndexAction
5346
| IGetAction
5447
| IDeleteAction
5548
| IAddAction
@@ -84,10 +77,6 @@ function testRunReducer(state: State, action: IAction): State {
8477
return {
8578
...state,
8679
selectedTestRunId: action.payload,
87-
};
88-
case "index":
89-
return {
90-
...state,
9180
selectedTestRunIndex: state.testRuns.findIndex(
9281
(t) => t.id === action.payload
9382
),
@@ -139,10 +128,6 @@ function testRunReducer(state: State, action: IAction): State {
139128
function TestRunProvider({ children }: TestRunProviderProps) {
140129
const [state, dispatch] = React.useReducer(testRunReducer, initialState);
141130

142-
React.useEffect(() => {
143-
setTestRunIndex(dispatch, state.selectedTestRunId);
144-
}, [state.selectedTestRunId, state.testRuns]);
145-
146131
return (
147132
<TestRunStateContext.Provider value={state}>
148133
<TestRunDispatchContext.Provider value={dispatch}>
@@ -187,10 +172,6 @@ async function selectTestRun(dispatch: Dispatch, id?: string) {
187172
dispatch({ type: "select", payload: id });
188173
}
189174

190-
async function setTestRunIndex(dispatch: Dispatch, index?: string) {
191-
dispatch({ type: "index", payload: index });
192-
}
193-
194175
async function addTestRun(dispatch: Dispatch, testRuns: Array<TestRun>) {
195176
dispatch({ type: "add", payload: testRuns });
196177
}

0 commit comments

Comments
 (0)