mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Use Tasks as query key
This commit is contained in:
parent
53a1cb413b
commit
709378f986
7 changed files with 14 additions and 18 deletions
|
@ -3,7 +3,7 @@ import Page from 'components/Page';
|
|||
import globalize from 'lib/globalize';
|
||||
import Box from '@mui/material/Box';
|
||||
import Stack from '@mui/material/Stack';
|
||||
import { useTasks } from '../../features/tasks/api/useTasks';
|
||||
import { QUERY_KEY, useTasks } from '../../features/tasks/api/useTasks';
|
||||
import { getCategories, getTasksByCategory } from '../../features/tasks/utils/tasks';
|
||||
import Loading from 'components/loading/LoadingComponent';
|
||||
import Tasks from '../../features/tasks/components/Tasks';
|
||||
|
@ -14,7 +14,6 @@ import Events, { Event } from 'utils/events';
|
|||
import { ApiClient } from 'jellyfin-apiclient';
|
||||
import { useApi } from 'hooks/useApi';
|
||||
import { queryClient } from 'utils/query/queryClient';
|
||||
import { QueryKey } from 'apps/dashboard/features/tasks/api/queryKey';
|
||||
|
||||
export const Component = () => {
|
||||
const { __legacyApiClient__ } = useApi();
|
||||
|
@ -23,13 +22,13 @@ export const Component = () => {
|
|||
// TODO: Replace usage of the legacy apiclient when websocket support is added to the TS SDK.
|
||||
useEffect(() => {
|
||||
const onScheduledTasksUpdate = (_e: Event, _apiClient: ApiClient, info: TaskInfo[]) => {
|
||||
queryClient.setQueryData([ QueryKey.Tasks ], info);
|
||||
queryClient.setQueryData([ QUERY_KEY ], info);
|
||||
};
|
||||
|
||||
const fallbackInterval = setInterval(() => {
|
||||
if (!__legacyApiClient__?.isMessageChannelOpen()) {
|
||||
void queryClient.invalidateQueries({
|
||||
queryKey: [ QueryKey.Tasks ]
|
||||
queryKey: [ QUERY_KEY ]
|
||||
});
|
||||
}
|
||||
}, 1e4);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue