From d858a0c5d8c0d9dcd3ab91cfdb468da51595a8de Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Fri, 14 Jul 2023 15:32:09 +1000 Subject: [PATCH] fix(ui): fix rtk tags I had mixed up `type` and `id` on a bunch of the tags. Fixing those --- .../src/services/api/endpoints/boardImages.ts | 11 ++++++----- .../web/src/services/api/endpoints/boards.ts | 19 +++++++++++++------ .../web/src/services/api/endpoints/models.ts | 18 +++++++++--------- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/invokeai/frontend/web/src/services/api/endpoints/boardImages.ts b/invokeai/frontend/web/src/services/api/endpoints/boardImages.ts index f7a486e8fc..39deaf4172 100644 --- a/invokeai/frontend/web/src/services/api/endpoints/boardImages.ts +++ b/invokeai/frontend/web/src/services/api/endpoints/boardImages.ts @@ -4,7 +4,7 @@ import { paths } from '../schema'; type ListBoardImagesArg = paths['/api/v1/board_images/{board_id}']['get']['parameters']['path'] & - paths['/api/v1/board_images/{board_id}']['get']['parameters']['query']; + paths['/api/v1/board_images/{board_id}']['get']['parameters']['query']; type AddImageToBoardArg = paths['/api/v1/board_images/']['post']['requestBody']['content']['application/json']; @@ -25,11 +25,12 @@ export const boardImagesApi = api.injectEndpoints({ query: ({ board_id, offset, limit }) => ({ url: `board_images/${board_id}`, method: 'GET', - }), providesTags: (result, error, arg) => { // any list of boardimages - const tags: ApiFullTagDescription[] = [{ id: 'BoardImage', type: `${arg.board_id}_${LIST_TAG}` }]; + const tags: ApiFullTagDescription[] = [ + { type: 'BoardImage', id: `${arg.board_id}_${LIST_TAG}` }, + ]; if (result) { // and individual tags for each boardimage @@ -57,7 +58,7 @@ export const boardImagesApi = api.injectEndpoints({ }), invalidatesTags: (result, error, arg) => [ { type: 'BoardImage' }, - { type: 'Board', id: arg.board_id } + { type: 'Board', id: arg.board_id }, ], }), @@ -69,7 +70,7 @@ export const boardImagesApi = api.injectEndpoints({ }), invalidatesTags: (result, error, arg) => [ { type: 'BoardImage' }, - { type: 'Board', id: arg.board_id } + { type: 'Board', id: arg.board_id }, ], }), }), diff --git a/invokeai/frontend/web/src/services/api/endpoints/boards.ts b/invokeai/frontend/web/src/services/api/endpoints/boards.ts index 64ab21075d..fc3cb530a4 100644 --- a/invokeai/frontend/web/src/services/api/endpoints/boards.ts +++ b/invokeai/frontend/web/src/services/api/endpoints/boards.ts @@ -20,7 +20,7 @@ export const boardsApi = api.injectEndpoints({ query: (arg) => ({ url: 'boards/', params: arg }), providesTags: (result, error, arg) => { // any list of boards - const tags: ApiFullTagDescription[] = [{ id: 'Board', type: LIST_TAG }]; + const tags: ApiFullTagDescription[] = [{ type: 'Board', id: LIST_TAG }]; if (result) { // and individual tags for each board @@ -43,7 +43,7 @@ export const boardsApi = api.injectEndpoints({ }), providesTags: (result, error, arg) => { // any list of boards - const tags: ApiFullTagDescription[] = [{ id: 'Board', type: LIST_TAG }]; + const tags: ApiFullTagDescription[] = [{ type: 'Board', id: LIST_TAG }]; if (result) { // and individual tags for each board @@ -69,7 +69,7 @@ export const boardsApi = api.injectEndpoints({ method: 'POST', params: { board_name }, }), - invalidatesTags: [{ id: 'Board', type: LIST_TAG }], + invalidatesTags: [{ type: 'Board', id: LIST_TAG }], }), updateBoard: build.mutation({ @@ -87,8 +87,15 @@ export const boardsApi = api.injectEndpoints({ invalidatesTags: (result, error, arg) => [{ type: 'Board', id: arg }], }), deleteBoardAndImages: build.mutation({ - query: (board_id) => ({ url: `boards/${board_id}`, method: 'DELETE', params: { include_images: true } }), - invalidatesTags: (result, error, arg) => [{ type: 'Board', id: arg }, { type: 'Image', id: LIST_TAG }], + query: (board_id) => ({ + url: `boards/${board_id}`, + method: 'DELETE', + params: { include_images: true }, + }), + invalidatesTags: (result, error, arg) => [ + { type: 'Board', id: arg }, + { type: 'Image', id: LIST_TAG }, + ], }), }), }); @@ -99,5 +106,5 @@ export const { useCreateBoardMutation, useUpdateBoardMutation, useDeleteBoardMutation, - useDeleteBoardAndImagesMutation + useDeleteBoardAndImagesMutation, } = boardsApi; diff --git a/invokeai/frontend/web/src/services/api/endpoints/models.ts b/invokeai/frontend/web/src/services/api/endpoints/models.ts index 95b2146448..f239d4c5e4 100644 --- a/invokeai/frontend/web/src/services/api/endpoints/models.ts +++ b/invokeai/frontend/web/src/services/api/endpoints/models.ts @@ -99,7 +99,7 @@ export const modelsApi = api.injectEndpoints({ query: () => ({ url: 'models/', params: { model_type: 'main' } }), providesTags: (result, error, arg) => { const tags: ApiFullTagDescription[] = [ - { id: 'MainModel', type: LIST_TAG }, + { type: 'MainModel', id: LIST_TAG }, ]; if (result) { @@ -138,7 +138,7 @@ export const modelsApi = api.injectEndpoints({ body: body, }; }, - invalidatesTags: ['MainModel'], + invalidatesTags: [{ type: 'MainModel', id: LIST_TAG }], }), deleteMainModels: build.mutation< EntityState, @@ -150,7 +150,7 @@ export const modelsApi = api.injectEndpoints({ method: 'DELETE', }; }, - invalidatesTags: ['MainModel'], + invalidatesTags: [{ type: 'MainModel', id: LIST_TAG }], }), convertMainModels: build.mutation< EntityState, @@ -162,7 +162,7 @@ export const modelsApi = api.injectEndpoints({ method: 'PUT', }; }, - invalidatesTags: ['MainModel'], + invalidatesTags: [{ type: 'MainModel', id: LIST_TAG }], }), mergeMainModels: build.mutation< EntityState, @@ -175,13 +175,13 @@ export const modelsApi = api.injectEndpoints({ body: body, }; }, - invalidatesTags: ['MainModel'], + invalidatesTags: [{ type: 'MainModel', id: LIST_TAG }], }), getLoRAModels: build.query, void>({ query: () => ({ url: 'models/', params: { model_type: 'lora' } }), providesTags: (result, error, arg) => { const tags: ApiFullTagDescription[] = [ - { id: 'LoRAModel', type: LIST_TAG }, + { type: 'LoRAModel', id: LIST_TAG }, ]; if (result) { @@ -216,7 +216,7 @@ export const modelsApi = api.injectEndpoints({ query: () => ({ url: 'models/', params: { model_type: 'controlnet' } }), providesTags: (result, error, arg) => { const tags: ApiFullTagDescription[] = [ - { id: 'ControlNetModel', type: LIST_TAG }, + { type: 'ControlNetModel', id: LIST_TAG }, ]; if (result) { @@ -248,7 +248,7 @@ export const modelsApi = api.injectEndpoints({ query: () => ({ url: 'models/', params: { model_type: 'vae' } }), providesTags: (result, error, arg) => { const tags: ApiFullTagDescription[] = [ - { id: 'VaeModel', type: LIST_TAG }, + { type: 'VaeModel', id: LIST_TAG }, ]; if (result) { @@ -283,7 +283,7 @@ export const modelsApi = api.injectEndpoints({ query: () => ({ url: 'models/', params: { model_type: 'embedding' } }), providesTags: (result, error, arg) => { const tags: ApiFullTagDescription[] = [ - { id: 'TextualInversionModel', type: LIST_TAG }, + { type: 'TextualInversionModel', id: LIST_TAG }, ]; if (result) {