Chore: Upgrade redux (#86877)

* update packages

* fix type errors

* upgrade redux toolkit as well

* don't need eslint-disable command

* remove comment

* fix unit tests

* call rtk query selector directly

* remove unnecessary checks
This commit is contained in:
Ashley Harrison
2024-05-10 14:28:51 +01:00
committed by GitHub
parent 926ee0f62e
commit 670960f70c
20 changed files with 119 additions and 157 deletions

View File

@@ -155,9 +155,9 @@ export const fetchRemotePlugins = createAsyncThunk<RemotePlugin[], void, { rejec
}
);
export const fetchDetails = createAsyncThunk<Update<CatalogPlugin>, string>(
export const fetchDetails = createAsyncThunk<Update<CatalogPlugin, string>, string>(
`${STATE_PREFIX}/fetchDetails`,
async (id: string, thunkApi) => {
async (id, thunkApi) => {
try {
const details = await getPluginDetails(id);
@@ -191,7 +191,7 @@ export const addLocalAndRemotePlugins = createAction<{ local: LocalPlugin[]; rem
// We are also using the install API endpoint to update the plugin
export const install = createAsyncThunk<
Update<CatalogPlugin>,
Update<CatalogPlugin, string>,
{
id: string;
version?: string;
@@ -222,7 +222,7 @@ export const install = createAsyncThunk<
export const unsetInstall = createAsyncThunk(`${STATE_PREFIX}/install`, async () => ({}));
export const uninstall = createAsyncThunk<Update<CatalogPlugin>, string>(
export const uninstall = createAsyncThunk<Update<CatalogPlugin, string>, string>(
`${STATE_PREFIX}/uninstall`,
async (id, thunkApi) => {
try {

View File

@@ -105,7 +105,7 @@ const slice = createSlice({
status: RequestStatus.Fulfilled,
};
})
.addMatcher(isRejectedRequest, (state, action) => {
.addMatcher(isRejectedRequest, (state, action: PayloadAction) => {
state.requests[getOriginalActionType(action.type)] = {
status: RequestStatus.Rejected,
error: action.payload,

View File

@@ -288,7 +288,7 @@ export type PluginDetailsTab = {
// TODO<remove `PluginsState &` when the "plugin_admin_enabled" feature flag is removed>
export type ReducerState = PluginsState & {
items: EntityState<CatalogPlugin>;
items: EntityState<CatalogPlugin, string>;
requests: Record<string, RequestInfo>;
settings: {
displayMode: PluginListDisplayMode;