mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
use correct query params for boardIdSelected listener
This commit is contained in:
parent
aaf83de364
commit
c3dd91e3c2
@ -1,13 +1,8 @@
|
|||||||
import { isAnyOf } from '@reduxjs/toolkit';
|
import { isAnyOf } from '@reduxjs/toolkit';
|
||||||
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
|
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
|
||||||
import {
|
import { boardIdSelected, galleryViewChanged, imageSelected, selectionChanged } from 'features/gallery/store/gallerySlice';
|
||||||
boardIdSelected,
|
|
||||||
galleryViewChanged,
|
|
||||||
imageSelected,
|
|
||||||
selectionChanged,
|
|
||||||
} from 'features/gallery/store/gallerySlice';
|
|
||||||
import { ASSETS_CATEGORIES, IMAGE_CATEGORIES } from 'features/gallery/store/types';
|
|
||||||
import { imagesApi } from 'services/api/endpoints/images';
|
import { imagesApi } from 'services/api/endpoints/images';
|
||||||
|
import { selectListImagesQueryArgs } from '../../../../../features/gallery/store/gallerySelectors';
|
||||||
|
|
||||||
export const addBoardIdSelectedListener = (startAppListening: AppStartListening) => {
|
export const addBoardIdSelectedListener = (startAppListening: AppStartListening) => {
|
||||||
startAppListening({
|
startAppListening({
|
||||||
@ -18,14 +13,7 @@ export const addBoardIdSelectedListener = (startAppListening: AppStartListening)
|
|||||||
|
|
||||||
const state = getState();
|
const state = getState();
|
||||||
|
|
||||||
const board_id = boardIdSelected.match(action) ? action.payload.boardId : state.gallery.selectedBoardId;
|
const queryArgs = selectListImagesQueryArgs(state);
|
||||||
|
|
||||||
const galleryView = galleryViewChanged.match(action) ? action.payload : state.gallery.galleryView;
|
|
||||||
|
|
||||||
// when a board is selected, we need to wait until the board has loaded *some* images, then select the first one
|
|
||||||
const categories = galleryView === 'images' ? IMAGE_CATEGORIES : ASSETS_CATEGORIES;
|
|
||||||
|
|
||||||
const queryArgs = { board_id: board_id ?? 'none', categories };
|
|
||||||
|
|
||||||
dispatch(selectionChanged([]));
|
dispatch(selectionChanged([]));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user