mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): model list refreshes after changes
When consolidating all the model queries I messed up the query tags. Fixed now, so that when a model is installed, removed, or changed, the list refreshes.
This commit is contained in:
parent
07c9c0b0ab
commit
3f61c51c3a
@ -1,5 +1,5 @@
|
|||||||
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
|
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
|
||||||
import { api } from 'services/api';
|
import { api, LIST_TAG } from 'services/api';
|
||||||
import { modelsApi } from 'services/api/endpoints/models';
|
import { modelsApi } from 'services/api/endpoints/models';
|
||||||
import {
|
import {
|
||||||
socketModelInstallCancelled,
|
socketModelInstallCancelled,
|
||||||
@ -42,7 +42,7 @@ export const addModelInstallEventListener = (startAppListening: AppStartListenin
|
|||||||
return draft;
|
return draft;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
dispatch(api.util.invalidateTags(['Model']));
|
dispatch(api.util.invalidateTags([{ type: 'ModelConfig', id: LIST_TAG }]));
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ export const modelsApi = api.injectEndpoints({
|
|||||||
body: formData,
|
body: formData,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
invalidatesTags: ['Model'],
|
invalidatesTags: [{ type: 'ModelConfig', id: LIST_TAG }],
|
||||||
}),
|
}),
|
||||||
installModel: build.mutation<InstallModelResponse, InstallModelArg>({
|
installModel: build.mutation<InstallModelResponse, InstallModelArg>({
|
||||||
query: ({ source, inplace = true }) => {
|
query: ({ source, inplace = true }) => {
|
||||||
@ -128,7 +128,7 @@ export const modelsApi = api.injectEndpoints({
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
invalidatesTags: ['Model', 'ModelInstalls'],
|
invalidatesTags: ['ModelInstalls'],
|
||||||
}),
|
}),
|
||||||
deleteModels: build.mutation<DeleteModelResponse, DeleteModelArg>({
|
deleteModels: build.mutation<DeleteModelResponse, DeleteModelArg>({
|
||||||
query: ({ key }) => {
|
query: ({ key }) => {
|
||||||
@ -137,7 +137,7 @@ export const modelsApi = api.injectEndpoints({
|
|||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
invalidatesTags: ['Model'],
|
invalidatesTags: [{ type: 'ModelConfig', id: LIST_TAG }],
|
||||||
}),
|
}),
|
||||||
deleteModelImage: build.mutation<DeleteModelImageResponse, string>({
|
deleteModelImage: build.mutation<DeleteModelImageResponse, string>({
|
||||||
query: (key) => {
|
query: (key) => {
|
||||||
@ -146,7 +146,7 @@ export const modelsApi = api.injectEndpoints({
|
|||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
invalidatesTags: ['Model'],
|
invalidatesTags: [{ type: 'ModelConfig', id: LIST_TAG }],
|
||||||
}),
|
}),
|
||||||
getModelImage: build.query<string, string>({
|
getModelImage: build.query<string, string>({
|
||||||
query: (key) => buildModelsUrl(`i/${key}/image`),
|
query: (key) => buildModelsUrl(`i/${key}/image`),
|
||||||
@ -158,12 +158,12 @@ export const modelsApi = api.injectEndpoints({
|
|||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
invalidatesTags: ['ModelConfig'],
|
invalidatesTags: [{ type: 'ModelConfig', id: LIST_TAG }],
|
||||||
}),
|
}),
|
||||||
getModelConfig: build.query<GetModelConfigResponse, string>({
|
getModelConfig: build.query<GetModelConfigResponse, string>({
|
||||||
query: (key) => buildModelsUrl(`i/${key}`),
|
query: (key) => buildModelsUrl(`i/${key}`),
|
||||||
providesTags: (result) => {
|
providesTags: (result) => {
|
||||||
const tags: ApiTagDescription[] = ['Model'];
|
const tags: ApiTagDescription[] = [];
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
tags.push({ type: 'ModelConfig', id: result.key });
|
tags.push({ type: 'ModelConfig', id: result.key });
|
||||||
@ -175,7 +175,7 @@ export const modelsApi = api.injectEndpoints({
|
|||||||
getModelConfigByAttrs: build.query<AnyModelConfig, GetByAttrsArg>({
|
getModelConfigByAttrs: build.query<AnyModelConfig, GetByAttrsArg>({
|
||||||
query: (arg) => buildModelsUrl(`get_by_attrs?${queryString.stringify(arg)}`),
|
query: (arg) => buildModelsUrl(`get_by_attrs?${queryString.stringify(arg)}`),
|
||||||
providesTags: (result) => {
|
providesTags: (result) => {
|
||||||
const tags: ApiTagDescription[] = ['Model'];
|
const tags: ApiTagDescription[] = [];
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
tags.push({ type: 'ModelConfig', id: result.key });
|
tags.push({ type: 'ModelConfig', id: result.key });
|
||||||
@ -192,7 +192,7 @@ export const modelsApi = api.injectEndpoints({
|
|||||||
method: 'PATCH',
|
method: 'PATCH',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
invalidatesTags: ['Model'],
|
invalidatesTags: [{ type: 'ModelConfig', id: LIST_TAG }],
|
||||||
}),
|
}),
|
||||||
scanFolder: build.query<ScanFolderResponse, ScanFolderArg>({
|
scanFolder: build.query<ScanFolderResponse, ScanFolderArg>({
|
||||||
query: (arg) => {
|
query: (arg) => {
|
||||||
|
@ -26,7 +26,6 @@ export const tagTypes = [
|
|||||||
'NextSessionQueueItem',
|
'NextSessionQueueItem',
|
||||||
'BatchStatus',
|
'BatchStatus',
|
||||||
'InvocationCacheStatus',
|
'InvocationCacheStatus',
|
||||||
'Model',
|
|
||||||
'ModelConfig',
|
'ModelConfig',
|
||||||
'ModelInstalls',
|
'ModelInstalls',
|
||||||
'T2IAdapterModel',
|
'T2IAdapterModel',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user