@@ -4,7 +4,6 @@ import { testRunService } from "../services";
44
55interface IRequestAction {
66 type : "request" ;
7- payload ?: undefined ;
87}
98
109interface IGetAction {
@@ -17,11 +16,6 @@ interface ISelectAction {
1716 payload ?: string ;
1817}
1918
20- interface IIndexAction {
21- type : "index" ;
22- payload ?: string ;
23- }
24-
2519interface IDeleteAction {
2620 type : "delete" ;
2721 payload : Array < string > ;
@@ -49,7 +43,6 @@ interface IRejectAction {
4943
5044type 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 {
139128function 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-
194175async function addTestRun ( dispatch : Dispatch , testRuns : Array < TestRun > ) {
195176 dispatch ( { type : "add" , payload : testRuns } ) ;
196177}
0 commit comments