mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
chore(ui): lint/format
This commit is contained in:
parent
734a9e4271
commit
57e8ec9488
@ -170,11 +170,11 @@ export const imagesApi = api.injectEndpoints({
|
|||||||
},
|
},
|
||||||
invalidatesTags: (result, error, { imageDTOs }) => {
|
invalidatesTags: (result, error, { imageDTOs }) => {
|
||||||
// for now, assume bulk delete is all on one board
|
// for now, assume bulk delete is all on one board
|
||||||
const boardId = imageDTOs[0]?.board_id
|
const boardId = imageDTOs[0]?.board_id;
|
||||||
return [
|
return [
|
||||||
{ type: 'BoardImagesTotal', id: boardId ?? 'none' },
|
{ type: 'BoardImagesTotal', id: boardId ?? 'none' },
|
||||||
{ type: 'BoardAssetsTotal', id: boardId ?? 'none' },
|
{ type: 'BoardAssetsTotal', id: boardId ?? 'none' },
|
||||||
]
|
];
|
||||||
},
|
},
|
||||||
async onQueryStarted({ imageDTOs }, { dispatch, queryFulfilled }) {
|
async onQueryStarted({ imageDTOs }, { dispatch, queryFulfilled }) {
|
||||||
/**
|
/**
|
||||||
@ -296,11 +296,11 @@ export const imagesApi = api.injectEndpoints({
|
|||||||
imageDTO.image_category
|
imageDTO.image_category
|
||||||
)
|
)
|
||||||
? boardsApi.endpoints.getBoardImagesTotal.select(
|
? boardsApi.endpoints.getBoardImagesTotal.select(
|
||||||
imageDTO.board_id ?? 'none'
|
imageDTO.board_id ?? 'none'
|
||||||
)(getState())
|
)(getState())
|
||||||
: boardsApi.endpoints.getBoardAssetsTotal.select(
|
: boardsApi.endpoints.getBoardAssetsTotal.select(
|
||||||
imageDTO.board_id ?? 'none'
|
imageDTO.board_id ?? 'none'
|
||||||
)(getState());
|
)(getState());
|
||||||
|
|
||||||
// IF it eligible for insertion into existing $cache
|
// IF it eligible for insertion into existing $cache
|
||||||
// "eligible" means either:
|
// "eligible" means either:
|
||||||
@ -726,11 +726,11 @@ export const imagesApi = api.injectEndpoints({
|
|||||||
imageDTO.image_category
|
imageDTO.image_category
|
||||||
)
|
)
|
||||||
? boardsApi.endpoints.getBoardImagesTotal.select(
|
? boardsApi.endpoints.getBoardImagesTotal.select(
|
||||||
imageDTO.board_id ?? 'none'
|
imageDTO.board_id ?? 'none'
|
||||||
)(getState())
|
)(getState())
|
||||||
: boardsApi.endpoints.getBoardAssetsTotal.select(
|
: boardsApi.endpoints.getBoardAssetsTotal.select(
|
||||||
imageDTO.board_id ?? 'none'
|
imageDTO.board_id ?? 'none'
|
||||||
)(getState());
|
)(getState());
|
||||||
|
|
||||||
const isCacheFullyPopulated =
|
const isCacheFullyPopulated =
|
||||||
currentCache.data && currentCache.data.ids.length >= (total ?? 0);
|
currentCache.data && currentCache.data.ids.length >= (total ?? 0);
|
||||||
@ -846,11 +846,11 @@ export const imagesApi = api.injectEndpoints({
|
|||||||
imageDTO.image_category
|
imageDTO.image_category
|
||||||
)
|
)
|
||||||
? boardsApi.endpoints.getBoardImagesTotal.select(
|
? boardsApi.endpoints.getBoardImagesTotal.select(
|
||||||
imageDTO.board_id ?? 'none'
|
imageDTO.board_id ?? 'none'
|
||||||
)(getState())
|
)(getState())
|
||||||
: boardsApi.endpoints.getBoardAssetsTotal.select(
|
: boardsApi.endpoints.getBoardAssetsTotal.select(
|
||||||
imageDTO.board_id ?? 'none'
|
imageDTO.board_id ?? 'none'
|
||||||
)(getState());
|
)(getState());
|
||||||
|
|
||||||
const isCacheFullyPopulated =
|
const isCacheFullyPopulated =
|
||||||
currentCache.data && currentCache.data.ids.length >= (total ?? 0);
|
currentCache.data && currentCache.data.ids.length >= (total ?? 0);
|
||||||
@ -912,7 +912,7 @@ export const imagesApi = api.injectEndpoints({
|
|||||||
// update the no_board totals
|
// update the no_board totals
|
||||||
{ type: 'BoardImagesTotal', id: 'none' },
|
{ type: 'BoardImagesTotal', id: 'none' },
|
||||||
{ type: 'BoardAssetsTotal', id: 'none' },
|
{ type: 'BoardAssetsTotal', id: 'none' },
|
||||||
]
|
];
|
||||||
},
|
},
|
||||||
async onQueryStarted(
|
async onQueryStarted(
|
||||||
{ board_id: new_board_id, imageDTOs },
|
{ board_id: new_board_id, imageDTOs },
|
||||||
@ -969,27 +969,26 @@ export const imagesApi = api.injectEndpoints({
|
|||||||
queryArgs
|
queryArgs
|
||||||
)(getState());
|
)(getState());
|
||||||
|
|
||||||
|
|
||||||
const { data: previousTotal } = IMAGE_CATEGORIES.includes(
|
const { data: previousTotal } = IMAGE_CATEGORIES.includes(
|
||||||
imageDTO.image_category
|
imageDTO.image_category
|
||||||
)
|
)
|
||||||
? boardsApi.endpoints.getBoardImagesTotal.select(
|
? boardsApi.endpoints.getBoardImagesTotal.select(
|
||||||
new_board_id ?? 'none'
|
new_board_id ?? 'none'
|
||||||
)(getState())
|
)(getState())
|
||||||
: boardsApi.endpoints.getBoardAssetsTotal.select(
|
: boardsApi.endpoints.getBoardAssetsTotal.select(
|
||||||
new_board_id ?? 'none'
|
new_board_id ?? 'none'
|
||||||
)(getState());
|
)(getState());
|
||||||
|
|
||||||
const isCacheFullyPopulated =
|
const isCacheFullyPopulated =
|
||||||
currentCache.data && currentCache.data.ids.length >= (previousTotal ?? 0);
|
currentCache.data &&
|
||||||
|
currentCache.data.ids.length >= (previousTotal ?? 0);
|
||||||
|
|
||||||
const isInDateRange = (previousTotal || 0) >= IMAGE_LIMIT ? getIsImageInDateRange(
|
const isInDateRange =
|
||||||
currentCache.data,
|
(previousTotal || 0) >= IMAGE_LIMIT
|
||||||
imageDTO
|
? getIsImageInDateRange(currentCache.data, imageDTO)
|
||||||
) : true;
|
: true;
|
||||||
|
|
||||||
if (isCacheFullyPopulated || isInDateRange) {
|
if (isCacheFullyPopulated || isInDateRange) {
|
||||||
console.log("upserting")
|
|
||||||
// *upsert* to $cache
|
// *upsert* to $cache
|
||||||
dispatch(
|
dispatch(
|
||||||
imagesApi.util.updateQueryData(
|
imagesApi.util.updateQueryData(
|
||||||
@ -1105,19 +1104,19 @@ export const imagesApi = api.injectEndpoints({
|
|||||||
imageDTO.image_category
|
imageDTO.image_category
|
||||||
)
|
)
|
||||||
? boardsApi.endpoints.getBoardImagesTotal.select(
|
? boardsApi.endpoints.getBoardImagesTotal.select(
|
||||||
imageDTO.board_id ?? 'none'
|
imageDTO.board_id ?? 'none'
|
||||||
)(getState())
|
)(getState())
|
||||||
: boardsApi.endpoints.getBoardAssetsTotal.select(
|
: boardsApi.endpoints.getBoardAssetsTotal.select(
|
||||||
imageDTO.board_id ?? 'none'
|
imageDTO.board_id ?? 'none'
|
||||||
)(getState());
|
)(getState());
|
||||||
|
|
||||||
const isCacheFullyPopulated =
|
const isCacheFullyPopulated =
|
||||||
currentCache.data && currentCache.data.ids.length >= (total ?? 0);
|
currentCache.data && currentCache.data.ids.length >= (total ?? 0);
|
||||||
|
|
||||||
const isInDateRange = (total || 0) >= IMAGE_LIMIT ? getIsImageInDateRange(
|
const isInDateRange =
|
||||||
currentCache.data,
|
(total || 0) >= IMAGE_LIMIT
|
||||||
imageDTO
|
? getIsImageInDateRange(currentCache.data, imageDTO)
|
||||||
) : true;
|
: true;
|
||||||
|
|
||||||
if (isCacheFullyPopulated || isInDateRange) {
|
if (isCacheFullyPopulated || isInDateRange) {
|
||||||
// *upsert* to $cache
|
// *upsert* to $cache
|
||||||
@ -1128,7 +1127,7 @@ export const imagesApi = api.injectEndpoints({
|
|||||||
(draft) => {
|
(draft) => {
|
||||||
imagesAdapter.upsertOne(draft, {
|
imagesAdapter.upsertOne(draft, {
|
||||||
...imageDTO,
|
...imageDTO,
|
||||||
board_id: "none",
|
board_id: 'none',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user