fix(ui): tidy remaining selectors

These were just using overly verbose syntax - like explicitly typing `state: RootState`, which is unnecessary.
This commit is contained in:
psychedelicious
2024-01-05 20:33:10 +11:00
parent f5f378d04b
commit 367de44a8b
43 changed files with 91 additions and 140 deletions

View File

@@ -1,5 +1,4 @@
import { Flex } from '@chakra-ui/react';
import type { RootState } from 'app/store/store';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import { InvButton } from 'common/components/InvButton/InvButton';
import { InvControl } from 'common/components/InvControl/InvControl';
@@ -22,9 +21,7 @@ import {
} from 'services/api/endpoints/models';
const FoundModelsList = () => {
const searchFolder = useAppSelector(
(state: RootState) => state.modelmanager.searchFolder
);
const searchFolder = useAppSelector((s) => s.modelmanager.searchFolder);
const [nameFilter, setNameFilter] = useState<string>('');
// Get paths of models that are already installed

View File

@@ -1,5 +1,4 @@
import { Box, Flex } from '@chakra-ui/react';
import type { RootState } from 'app/store/store';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import { InvControl } from 'common/components/InvControl/InvControl';
import { InvIconButton } from 'common/components/InvIconButton/InvIconButton';
@@ -21,7 +20,7 @@ import { isManualAddMode } from './AdvancedAddModels';
const ScanAdvancedAddModels = () => {
const advancedAddScanModel = useAppSelector(
(state: RootState) => state.modelmanager.advancedAddScanModel
(s) => s.modelmanager.advancedAddScanModel
);
const { t } = useTranslation();

View File

@@ -1,6 +1,5 @@
import { Flex } from '@chakra-ui/react';
import { useForm } from '@mantine/form';
import type { RootState } from 'app/store/store';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import { InvIconButton } from 'common/components/InvIconButton/InvIconButton';
import { InvInput } from 'common/components/InvInput/InvInput';
@@ -23,9 +22,7 @@ function SearchFolderForm() {
const dispatch = useAppDispatch();
const { t } = useTranslation();
const searchFolder = useAppSelector(
(state: RootState) => state.modelmanager.searchFolder
);
const searchFolder = useAppSelector((s) => s.modelmanager.searchFolder);
const { refetch: refetchFoundModels } = useGetModelsInFolderQuery({
search_path: searchFolder ? searchFolder : '',