1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-28 23:16:32 -04:00

Use react-query for UI settings

This commit is contained in:
Mark McDowall
2025-12-28 16:35:16 -08:00
parent e9011011ed
commit 74e6ce4305
32 changed files with 264 additions and 263 deletions
@@ -1,6 +1,5 @@
import moment from 'moment';
import React, { useCallback, useEffect, useRef, useState } from 'react';
import { useSelector } from 'react-redux';
import { CommandBody } from 'Commands/Command';
import { useCancelCommand } from 'Commands/useCommands';
import Icon, { IconProps } from 'Components/Icon';
@@ -10,7 +9,7 @@ import TableRowCell from 'Components/Table/Cells/TableRowCell';
import TableRow from 'Components/Table/TableRow';
import useModalOpenState from 'Helpers/Hooks/useModalOpenState';
import { icons, kinds } from 'Helpers/Props';
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
import { useUiSettingsValues } from 'Settings/UI/useUiSettings';
import formatDate from 'Utilities/Date/formatDate';
import formatDateTime from 'Utilities/Date/formatDateTime';
import formatTimeSpan from 'Utilities/Date/formatTimeSpan';
@@ -120,7 +119,7 @@ export default function QueuedTaskRow(props: QueuedTaskRowProps) {
const { cancelCommand } = useCancelCommand(id);
const { longDateFormat, shortDateFormat, showRelativeDates, timeFormat } =
useSelector(createUISettingsSelector());
useUiSettingsValues();
const updateTimeTimeoutId = useRef<ReturnType<typeof setTimeout> | null>(
null
@@ -1,12 +1,11 @@
import moment from 'moment';
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { useSelector } from 'react-redux';
import { useCommand, useExecuteCommand } from 'Commands/useCommands';
import SpinnerIconButton from 'Components/Link/SpinnerIconButton';
import TableRowCell from 'Components/Table/Cells/TableRowCell';
import TableRow from 'Components/Table/TableRow';
import { icons } from 'Helpers/Props';
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
import { useUiSettingsValues } from 'Settings/UI/useUiSettings';
import { isCommandExecuting } from 'Utilities/Command';
import formatDate from 'Utilities/Date/formatDate';
import formatDateTime from 'Utilities/Date/formatDateTime';
@@ -35,7 +34,7 @@ function ScheduledTaskRow({
}: ScheduledTaskRowProps) {
const executeCommand = useExecuteCommand();
const { showRelativeDates, longDateFormat, shortDateFormat, timeFormat } =
useSelector(createUISettingsSelector());
useUiSettingsValues();
const command = useCommand(taskName);
const [time, setTime] = useState(Date.now());