Skip to content

Commit

Permalink
fix(ui): remove unused queries and fix invocation complete listener
Browse files Browse the repository at this point in the history
  • Loading branch information
psychedelicious committed Jul 12, 2024
1 parent c957f4b commit fcc3f7f
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
import { $nodeExecutionStates, upsertExecutionState } from 'features/nodes/hooks/useExecutionState';
import { zNodeStatus } from 'features/nodes/types/invocation';
import { CANVAS_OUTPUT } from 'features/nodes/util/graph/constants';
import { boardsApi } from 'services/api/endpoints/boards';
import { imagesApi } from 'services/api/endpoints/images';
import { getCategories, getListImagesUrl } from 'services/api/util';
import { socketInvocationComplete } from 'services/events/actions';
Expand Down Expand Up @@ -52,14 +51,6 @@ export const addInvocationCompleteEventListener = (startAppListening: AppStartLi
}

if (!imageDTO.is_intermediate) {
// update the total images for the board
dispatch(
boardsApi.util.updateQueryData('getBoardImagesTotal', imageDTO.board_id ?? 'none', (draft) => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
draft.total += 1;
})
);

dispatch(
imagesApi.util.invalidateTags([
{ type: 'Board', id: imageDTO.board_id ?? 'none' },
Expand Down
47 changes: 1 addition & 46 deletions invokeai/frontend/web/src/services/api/endpoints/boards.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
import { ASSETS_CATEGORIES, IMAGE_CATEGORIES } from 'features/gallery/store/types';
import type {
BoardDTO,
CreateBoardArg,
ListBoardsArgs,
OffsetPaginatedResults_ImageDTO_,
S,
UpdateBoardArg,
} from 'services/api/types';
import { getListImagesUrl } from 'services/api/util';
import type { BoardDTO, CreateBoardArg, ListBoardsArgs, S, UpdateBoardArg } from 'services/api/types';

import type { ApiTagDescription } from '..';
import { api, buildV1Url, LIST_TAG } from '..';
Expand Down Expand Up @@ -63,40 +54,6 @@ export const boardsApi = api.injectEndpoints({
providesTags: ['UncategorizedImageCounts', { type: 'Board', id: LIST_TAG }, { type: 'Board', id: 'none' }],
}),

getBoardImagesTotal: build.query<{ total: number }, string | undefined>({
query: (board_id) => ({
url: getListImagesUrl({
board_id: board_id ?? 'none',
categories: IMAGE_CATEGORIES,
is_intermediate: false,
limit: 0,
offset: 0,
}),
method: 'GET',
}),
providesTags: (result, error, arg) => [{ type: 'BoardImagesTotal', id: arg ?? 'none' }, 'FetchOnReconnect'],
transformResponse: (response: OffsetPaginatedResults_ImageDTO_) => {
return { total: response.total };
},
}),

getBoardAssetsTotal: build.query<{ total: number }, string | undefined>({
query: (board_id) => ({
url: getListImagesUrl({
board_id: board_id ?? 'none',
categories: ASSETS_CATEGORIES,
is_intermediate: false,
limit: 0,
offset: 0,
}),
method: 'GET',
}),
providesTags: (result, error, arg) => [{ type: 'BoardAssetsTotal', id: arg ?? 'none' }, 'FetchOnReconnect'],
transformResponse: (response: OffsetPaginatedResults_ImageDTO_) => {
return { total: response.total };
},
}),

/**
* Boards Mutations
*/
Expand Down Expand Up @@ -132,8 +89,6 @@ export const boardsApi = api.injectEndpoints({

export const {
useListAllBoardsQuery,
useGetBoardImagesTotalQuery,
useGetBoardAssetsTotalQuery,
useCreateBoardMutation,
useUpdateBoardMutation,
useListAllImageNamesForBoardQuery,
Expand Down
1 change: 0 additions & 1 deletion invokeai/frontend/web/src/services/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export type AppDependencyVersions = S['AppDependencyVersions'];
export type ImageDTO = S['ImageDTO'];
export type BoardDTO = S['BoardDTO'];
export type ImageCategory = S['ImageCategory'];
export type OffsetPaginatedResults_ImageDTO_ = S['OffsetPaginatedResults_ImageDTO_'];

// Models
export type ModelType = S['ModelType'];
Expand Down

0 comments on commit fcc3f7f

Please sign in to comment.