From 4f95c077d4bfc767930368f9438875371e0c4bbd Mon Sep 17 00:00:00 2001 From: Mary Hipp Date: Fri, 12 Jan 2024 14:38:58 -0500 Subject: [PATCH] lint fix --- .../listenerMiddleware/listeners/imageUploaded.ts | 4 ++-- .../common/components/InvExpander/InvExpander.tsx | 3 +-- .../src/common/components/InvExpander/types.ts | 3 +-- .../InvSingleAccordion/InvSingleAccordion.tsx | 4 ++-- .../common/components/InvSingleAccordion/types.ts | 2 +- .../components/Boards/BoardContextMenu.tsx | 2 +- .../Boards/BoardsList/AddBoardButton.tsx | 4 ++-- .../MultipleSelectionMenuItems.tsx | 2 +- .../web/src/features/gallery/store/actions.ts | 8 ++++++-- .../web/src/features/parameters/store/actions.ts | 12 +++++++++--- .../AdvancedSettingsAccordion.tsx | 15 +++++++++------ .../GenerationSettingsAccordion.tsx | 15 +++++++++------ .../ImageSettingsAccordion.tsx | 15 +++++++++------ 13 files changed, 53 insertions(+), 36 deletions(-) diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageUploaded.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageUploaded.ts index e05668868d..a60e0feacc 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageUploaded.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageUploaded.ts @@ -5,6 +5,7 @@ import { controlAdapterImageChanged, controlAdapterIsEnabledChanged, } from 'features/controlAdapters/store/controlAdaptersSlice'; +import { imageUploaded } from 'features/gallery/store/actions'; import { fieldImageValueChanged } from 'features/nodes/store/nodesSlice'; import { initialImageChanged, @@ -17,7 +18,6 @@ import { boardsApi } from 'services/api/endpoints/boards'; import { imagesApi } from 'services/api/endpoints/images'; import { startAppListening } from '..'; -import { imageUploaded } from '../../../../../features/gallery/store/actions'; export const addImageUploadedFulfilledListener = () => { startAppListening({ @@ -41,7 +41,7 @@ export const addImageUploadedFulfilledListener = () => { return; } - dispatch(imageUploaded({ postUploadAction: postUploadAction?.type })) + dispatch(imageUploaded({ postUploadAction: postUploadAction?.type })); const DEFAULT_UPLOADED_TOAST: UseToastOptions = { title: t('toast.imageUploaded'), diff --git a/invokeai/frontend/web/src/common/components/InvExpander/InvExpander.tsx b/invokeai/frontend/web/src/common/components/InvExpander/InvExpander.tsx index c1a3653129..9940ce9841 100644 --- a/invokeai/frontend/web/src/common/components/InvExpander/InvExpander.tsx +++ b/invokeai/frontend/web/src/common/components/InvExpander/InvExpander.tsx @@ -4,9 +4,8 @@ import { Collapse, Icon, useDisclosure } from '@chakra-ui/react'; import type { InvExpanderProps } from 'common/components/InvExpander/types'; import { InvText } from 'common/components/InvText/wrapper'; import { t } from 'i18next'; -import { BiCollapseVertical, BiExpandVertical } from 'react-icons/bi'; -import { useAppDispatch } from '../../../app/store/storeHooks'; import { useCallback } from 'react'; +import { BiCollapseVertical, BiExpandVertical } from 'react-icons/bi'; const buttonStyles: SystemStyleObject = { color: 'base.400', diff --git a/invokeai/frontend/web/src/common/components/InvExpander/types.ts b/invokeai/frontend/web/src/common/components/InvExpander/types.ts index 998615b528..3b34bc421c 100644 --- a/invokeai/frontend/web/src/common/components/InvExpander/types.ts +++ b/invokeai/frontend/web/src/common/components/InvExpander/types.ts @@ -1,8 +1,7 @@ -import { ThunkAction } from '@reduxjs/toolkit'; import type { PropsWithChildren } from 'react'; export type InvExpanderProps = PropsWithChildren<{ label?: string; defaultIsOpen?: boolean; - onClick?: (isOpen: boolean) => void + onClick?: (isOpen: boolean) => void; }>; diff --git a/invokeai/frontend/web/src/common/components/InvSingleAccordion/InvSingleAccordion.tsx b/invokeai/frontend/web/src/common/components/InvSingleAccordion/InvSingleAccordion.tsx index 40c126b24a..7408d1a6c6 100644 --- a/invokeai/frontend/web/src/common/components/InvSingleAccordion/InvSingleAccordion.tsx +++ b/invokeai/frontend/web/src/common/components/InvSingleAccordion/InvSingleAccordion.tsx @@ -13,7 +13,7 @@ export const InvSingleAccordion = memo((props: InvSingleAccordionProps) => { (isExpanded: boolean) => { props.onClick && props.onClick(isExpanded); }, - [props.onClick] + [props] ); return ( @@ -26,7 +26,7 @@ export const InvSingleAccordion = memo((props: InvSingleAccordionProps) => { <> handleAccordionClick(isExpanded)} + onClick={handleAccordionClick.bind(null, isExpanded)} > {props.label} diff --git a/invokeai/frontend/web/src/common/components/InvSingleAccordion/types.ts b/invokeai/frontend/web/src/common/components/InvSingleAccordion/types.ts index 3045365f51..6d66d0baa7 100644 --- a/invokeai/frontend/web/src/common/components/InvSingleAccordion/types.ts +++ b/invokeai/frontend/web/src/common/components/InvSingleAccordion/types.ts @@ -4,5 +4,5 @@ export type InvSingleAccordionProps = PropsWithChildren<{ label: string; badges?: (string | number)[]; defaultIsOpen?: boolean; - onClick?: (isOpen?: boolean) => void + onClick?: (isOpen?: boolean) => void; }>; diff --git a/invokeai/frontend/web/src/features/gallery/components/Boards/BoardContextMenu.tsx b/invokeai/frontend/web/src/features/gallery/components/Boards/BoardContextMenu.tsx index 3d44976886..559ac06501 100644 --- a/invokeai/frontend/web/src/features/gallery/components/Boards/BoardContextMenu.tsx +++ b/invokeai/frontend/web/src/features/gallery/components/Boards/BoardContextMenu.tsx @@ -5,6 +5,7 @@ import { InvContextMenu } from 'common/components/InvContextMenu/InvContextMenu' import { InvMenuItem } from 'common/components/InvMenu/InvMenuItem'; import { InvMenuList } from 'common/components/InvMenu/InvMenuList'; import { InvMenuGroup } from 'common/components/InvMenu/wrapper'; +import { bulkDownloadRequested } from 'features/gallery/store/actions'; import { autoAddBoardIdChanged, selectGallerySlice, @@ -20,7 +21,6 @@ import { useBoardName } from 'services/api/hooks/useBoardName'; import type { BoardDTO } from 'services/api/types'; import GalleryBoardContextMenuItems from './GalleryBoardContextMenuItems'; -import { bulkDownloadRequested } from '../../store/actions'; type Props = { board?: BoardDTO; diff --git a/invokeai/frontend/web/src/features/gallery/components/Boards/BoardsList/AddBoardButton.tsx b/invokeai/frontend/web/src/features/gallery/components/Boards/BoardsList/AddBoardButton.tsx index 7e4d3cf73c..b0770ca639 100644 --- a/invokeai/frontend/web/src/features/gallery/components/Boards/BoardsList/AddBoardButton.tsx +++ b/invokeai/frontend/web/src/features/gallery/components/Boards/BoardsList/AddBoardButton.tsx @@ -1,10 +1,10 @@ +import { useAppDispatch } from 'app/store/storeHooks'; import { InvIconButton } from 'common/components/InvIconButton/InvIconButton'; +import { boardCreated } from 'features/gallery/store/actions'; import { memo, useCallback } from 'react'; import { useTranslation } from 'react-i18next'; import { PiPlusBold } from 'react-icons/pi'; import { useCreateBoardMutation } from 'services/api/endpoints/boards'; -import { useAppDispatch } from '../../../../../app/store/storeHooks'; -import { boardCreated } from '../../../store/actions'; const AddBoardButton = () => { const { t } = useTranslation(); diff --git a/invokeai/frontend/web/src/features/gallery/components/ImageContextMenu/MultipleSelectionMenuItems.tsx b/invokeai/frontend/web/src/features/gallery/components/ImageContextMenu/MultipleSelectionMenuItems.tsx index 57f8340541..6f38f859b4 100644 --- a/invokeai/frontend/web/src/features/gallery/components/ImageContextMenu/MultipleSelectionMenuItems.tsx +++ b/invokeai/frontend/web/src/features/gallery/components/ImageContextMenu/MultipleSelectionMenuItems.tsx @@ -8,6 +8,7 @@ import { isModalOpenChanged, } from 'features/changeBoardModal/store/slice'; import { imagesToDeleteSelected } from 'features/deleteImageModal/store/slice'; +import { bulkDownloadRequested } from 'features/gallery/store/actions'; import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus'; import { addToast } from 'features/system/store/systemSlice'; import { memo, useCallback, useMemo } from 'react'; @@ -24,7 +25,6 @@ import { useStarImagesMutation, useUnstarImagesMutation, } from 'services/api/endpoints/images'; -import { bulkDownloadRequested } from '../../store/actions'; const MultipleSelectionMenuItems = () => { const { t } = useTranslation(); diff --git a/invokeai/frontend/web/src/features/gallery/store/actions.ts b/invokeai/frontend/web/src/features/gallery/store/actions.ts index b23938d64a..070a9197b8 100644 --- a/invokeai/frontend/web/src/features/gallery/store/actions.ts +++ b/invokeai/frontend/web/src/features/gallery/store/actions.ts @@ -16,7 +16,11 @@ export const sentImageToCanvas = createAction('gallery/sentImageToCanvas'); export const sentImageToImg2Img = createAction('gallery/sentImageToImg2Img'); -export const imageUploaded = createAction<{ postUploadAction?: string }>('gallery/imageUploaded'); +export const imageUploaded = createAction<{ postUploadAction?: string }>( + 'gallery/imageUploaded' +); export const boardCreated = createAction('gallery/boardCreated'); -export const bulkDownloadRequested = createAction<{ type: string }>('gallery/bulkDownloadRequested') \ No newline at end of file +export const bulkDownloadRequested = createAction<{ type: string }>( + 'gallery/bulkDownloadRequested' +); diff --git a/invokeai/frontend/web/src/features/parameters/store/actions.ts b/invokeai/frontend/web/src/features/parameters/store/actions.ts index c500ee0ed8..7b54787efb 100644 --- a/invokeai/frontend/web/src/features/parameters/store/actions.ts +++ b/invokeai/frontend/web/src/features/parameters/store/actions.ts @@ -9,7 +9,13 @@ export const modelSelected = createAction( 'generation/modelSelected' ); -export const imageAdvancedOptionsExpanded = createAction('parameters/imageAdvancedOptionsExpanded') -export const generationAdvancedOptionsExpanded = createAction('parameters/generationAdvancedOptionsExpanded') +export const imageAdvancedOptionsExpanded = createAction( + 'parameters/imageAdvancedOptionsExpanded' +); +export const generationAdvancedOptionsExpanded = createAction( + 'parameters/generationAdvancedOptionsExpanded' +); -export const advancedPanelExpanded = createAction('parameters/advancedPanelExpanded') +export const advancedPanelExpanded = createAction( + 'parameters/advancedPanelExpanded' +); diff --git a/invokeai/frontend/web/src/features/settingsAccordions/AdvancedSettingsAccordion/AdvancedSettingsAccordion.tsx b/invokeai/frontend/web/src/features/settingsAccordions/AdvancedSettingsAccordion/AdvancedSettingsAccordion.tsx index e6e9a886e4..6b25e87edf 100644 --- a/invokeai/frontend/web/src/features/settingsAccordions/AdvancedSettingsAccordion/AdvancedSettingsAccordion.tsx +++ b/invokeai/frontend/web/src/features/settingsAccordions/AdvancedSettingsAccordion/AdvancedSettingsAccordion.tsx @@ -10,10 +10,10 @@ import ParamSeamlessXAxis from 'features/parameters/components/Seamless/ParamSea import ParamSeamlessYAxis from 'features/parameters/components/Seamless/ParamSeamlessYAxis'; import ParamVAEModelSelect from 'features/parameters/components/VAEModel/ParamVAEModelSelect'; import ParamVAEPrecision from 'features/parameters/components/VAEModel/ParamVAEPrecision'; +import { advancedPanelExpanded } from 'features/parameters/store/actions'; import { selectGenerationSlice } from 'features/parameters/store/generationSlice'; import { memo, useCallback } from 'react'; import { useTranslation } from 'react-i18next'; -import { advancedPanelExpanded } from '../../parameters/store/actions'; const labelProps: InvLabelProps = { minW: '9.2rem', @@ -54,11 +54,14 @@ export const AdvancedSettingsAccordion = memo(() => { const { t } = useTranslation(); const dispatch = useAppDispatch(); - const onAccordionClick = useCallback((isOpen?: boolean) => { - if (!isOpen) { - dispatch(advancedPanelExpanded()); - } - }, []); + const onAccordionClick = useCallback( + (isOpen?: boolean) => { + if (!isOpen) { + dispatch(advancedPanelExpanded()); + } + }, + [dispatch] + ); return ( { const { loraTabBadges, accordionBadges } = useAppSelector(badgesSelector); const dispatch = useAppDispatch(); - const onToggleExpander = useCallback((isOpen?: boolean) => { - if (!isOpen) { - dispatch(generationAdvancedOptionsExpanded()); - } - }, []); + const onToggleExpander = useCallback( + (isOpen?: boolean) => { + if (!isOpen) { + dispatch(generationAdvancedOptionsExpanded()); + } + }, + [dispatch] + ); return ( { const { badges, activeTabName } = useAppSelector(selector); const dispatch = useAppDispatch(); - const onToggleExpander = useCallback((isOpen?: boolean) => { - if (!isOpen) { - dispatch(imageAdvancedOptionsExpanded()); - } - }, []); + const onToggleExpander = useCallback( + (isOpen?: boolean) => { + if (!isOpen) { + dispatch(imageAdvancedOptionsExpanded()); + } + }, + [dispatch] + ); return (