Remove listenerMiddleware

This commit is contained in:
Jason Zhu 2023-05-08 21:23:24 +10:00
parent 5317050679
commit 7f563d8c73
4 changed files with 3 additions and 24 deletions

View File

@ -1,9 +0,0 @@
import { createListenerMiddleware } from '@reduxjs/toolkit';
import type { TypedStartListening } from '@reduxjs/toolkit';
import { AppDispatch, RootState } from 'app/store';
export const listenerMiddleware = createListenerMiddleware();
export type AppStartListening = TypedStartListening<RootState, AppDispatch>;
export const startAppListening =
listenerMiddleware.startListening as AppStartListening;

View File

@ -1,5 +1,4 @@
import { configureStore } from '@reduxjs/toolkit';
import { listenerMiddleware } from './listenerMiddleware';
import { pokedexSlice } from 'features/Pokedex/pokedexSlice';
import { filterSlice } from 'features/Filters/filterSlice';
import { filterApi } from 'features/Filters/filterApi';
@ -14,10 +13,7 @@ export const store = configureStore({
[filterApi.reducerPath]: filterApi.reducer,
},
middleware: getDefaultMiddleware =>
getDefaultMiddleware().concat(
filterApi.middleware,
listenerMiddleware.middleware,
),
getDefaultMiddleware().concat(filterApi.middleware),
devTools: true,
});

View File

@ -4,7 +4,6 @@ import { filterSlice } from './filterSlice';
import { configureStore } from '@reduxjs/toolkit';
import { AppStore } from 'app/store';
import { listenerMiddleware } from 'app/listenerMiddleware';
import { TypeListResponseData } from 'features/Pokedex/types/api';
let store: AppStore;
@ -18,10 +17,7 @@ describe('filterApi', () => {
[filterApi.reducerPath]: filterApi.reducer,
},
middleware: getDefaultMiddleware =>
getDefaultMiddleware().concat(
filterApi.middleware,
listenerMiddleware.middleware,
),
getDefaultMiddleware().concat(filterApi.middleware),
});
});

View File

@ -11,7 +11,6 @@ import { configureStore } from '@reduxjs/toolkit';
import { pokedexSlice } from 'features/Pokedex/pokedexSlice';
import { filterSlice } from 'features/Filters/filterSlice';
import { filterApi } from 'features/Filters/filterApi';
import { listenerMiddleware } from 'app/listenerMiddleware';
let store: AppStore;
@ -24,10 +23,7 @@ describe('pokedex Component', () => {
[filterApi.reducerPath]: filterApi.reducer,
},
middleware: getDefaultMiddleware =>
getDefaultMiddleware().concat(
filterApi.middleware,
listenerMiddleware.middleware,
),
getDefaultMiddleware().concat(filterApi.middleware),
});
});