mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): fix more state => state
selectors
This commit is contained in:
parent
29bbb27289
commit
823edbfdef
@ -2,7 +2,6 @@ import { Flex } from '@chakra-ui/react';
|
||||
import { memo } from 'react';
|
||||
|
||||
import CurrentImageButtons from './CurrentImageButtons';
|
||||
import CurrentImagePreview from './CurrentImagePreview';
|
||||
|
||||
const CurrentImageDisplay = () => {
|
||||
return (
|
||||
@ -16,7 +15,7 @@ const CurrentImageDisplay = () => {
|
||||
justifyContent="center"
|
||||
>
|
||||
<CurrentImageButtons />
|
||||
<CurrentImagePreview />
|
||||
{/* <CurrentImagePreview /> */}
|
||||
</Flex>
|
||||
);
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { createMemoizedSelector } from 'app/store/createMemoizedSelector';
|
||||
import type { RootState } from 'app/store/store';
|
||||
import { selectGallerySlice } from 'features/gallery/store/gallerySlice';
|
||||
import type { ListImagesArgs } from 'services/api/types';
|
||||
|
||||
import {
|
||||
@ -8,17 +8,15 @@ import {
|
||||
INITIAL_IMAGE_LIMIT,
|
||||
} from './types';
|
||||
|
||||
export const gallerySelector = (state: RootState) => state.gallery;
|
||||
|
||||
export const selectLastSelectedImage = createMemoizedSelector(
|
||||
(state: RootState) => state,
|
||||
(s) => s.gallery.selection[state.gallery.selection.length - 1]
|
||||
selectGallerySlice,
|
||||
(gallery) => gallery.selection[gallery.selection.length - 1]
|
||||
);
|
||||
|
||||
export const selectListImagesBaseQueryArgs = createMemoizedSelector(
|
||||
[(state: RootState) => state],
|
||||
(state) => {
|
||||
const { selectedBoardId, galleryView } = state.gallery;
|
||||
selectGallerySlice,
|
||||
(gallery) => {
|
||||
const { selectedBoardId, galleryView } = gallery;
|
||||
const categories =
|
||||
galleryView === 'images' ? IMAGE_CATEGORIES : ASSETS_CATEGORIES;
|
||||
|
||||
|
@ -1,21 +1,23 @@
|
||||
import { createMemoizedSelector } from 'app/store/createMemoizedSelector';
|
||||
import type { RootState } from 'app/store/store';
|
||||
import { selectConfigSlice } from 'features/system/store/configSlice';
|
||||
import { selectUiSlice } from 'features/ui/store/uiSlice';
|
||||
import { isString } from 'lodash-es';
|
||||
|
||||
import { tabMap } from './tabMap';
|
||||
|
||||
export const activeTabNameSelector = createMemoizedSelector(
|
||||
(state: RootState) => state,
|
||||
selectUiSlice,
|
||||
/**
|
||||
* Previously `activeTab` was an integer, but now it's a string.
|
||||
* Default to first tab in case user has integer.
|
||||
*/
|
||||
({ ui }) => (isString(ui.activeTab) ? ui.activeTab : 'txt2img')
|
||||
(ui) => (isString(ui.activeTab) ? ui.activeTab : 'txt2img')
|
||||
);
|
||||
|
||||
export const activeTabIndexSelector = createMemoizedSelector(
|
||||
(state: RootState) => state,
|
||||
({ ui, config }) => {
|
||||
selectUiSlice,
|
||||
selectConfigSlice,
|
||||
(ui, config) => {
|
||||
const tabs = tabMap.filter((t) => !config.disabledTabs.includes(t));
|
||||
const idx = tabs.indexOf(ui.activeTab);
|
||||
return idx === -1 ? 0 : idx;
|
||||
|
Loading…
Reference in New Issue
Block a user