ESLint: Resolve useSelector-prefer-selectors errors

This resolves all occurences of useSelector-prefer-selectors errors.
This commit is contained in:
regexowl 2024-03-27 13:28:27 +01:00 committed by Lucas Garfield
parent 3d9f171611
commit 155962c141
33 changed files with 103 additions and 165 deletions

View file

@ -54,10 +54,8 @@ export const FileSystemStepFooter = () => {
const [isValid, setIsValid] = useState(false);
const dispatch = useAppDispatch();
const [isNextDisabled, setNextDisabled] = useState(false);
const fileSystemPartitionMode = useAppSelector((state) =>
selectFileSystemPartitionMode(state)
);
const partitions = useAppSelector((state) => selectPartitions(state));
const fileSystemPartitionMode = useAppSelector(selectFileSystemPartitionMode);
const partitions = useAppSelector(selectPartitions);
const onValidate = () => {
dispatch(setIsNextButtonTouched(false));
@ -93,14 +91,12 @@ export const FileSystemStepFooter = () => {
};
const FileSystemConfiguration = () => {
const partitions = useAppSelector((state) => selectPartitions(state));
const environments = useAppSelector((state) => selectImageTypes(state));
const partitions = useAppSelector(selectPartitions);
const environments = useAppSelector(selectImageTypes);
const dispatch = useAppDispatch();
const isNextButtonPristine = useAppSelector((state) =>
selectIsNextButtonTouched(state)
);
const isNextButtonPristine = useAppSelector(selectIsNextButtonTouched);
const handleAddPartition = () => {
const id = uuidv4();
dispatch(
@ -233,13 +229,11 @@ const getSuffix = (mountpoint: string) => {
const Row = ({ partition }: RowPropTypes) => {
const dispatch = useAppDispatch();
const partitions = useAppSelector((state) => selectPartitions(state));
const partitions = useAppSelector(selectPartitions);
const handleRemovePartition = (id: string) => {
dispatch(removePartition(id));
};
const isNextButtonPristine = useAppSelector((state) =>
selectIsNextButtonTouched(state)
);
const isNextButtonPristine = useAppSelector(selectIsNextButtonTouched);
const duplicates = getDuplicateMountPoints(partitions);
return (

View file

@ -14,9 +14,7 @@ import {
const FileSystemPartition = () => {
const id = uuidv4();
const dispatch = useAppDispatch();
const fileSystemPartitionMode = useAppSelector((state) =>
selectFileSystemPartitionMode(state)
);
const fileSystemPartitionMode = useAppSelector(selectFileSystemPartitionMode);
return (
<FormGroup>
<Radio

View file

@ -11,9 +11,7 @@ import { selectFileSystemPartitionMode } from '../../../../store/wizardSlice';
export type FileSystemPartitionMode = 'automatic' | 'manual';
const FileSystemStep = () => {
const fileSystemPartitionMode = useAppSelector((state) =>
selectFileSystemPartitionMode(state)
);
const fileSystemPartitionMode = useAppSelector(selectFileSystemPartitionMode);
return (
<Form>