improvements in react-query

- fetch to useFetch hook
- refetch every 10s
- sync browser tabs with experimental broadcastQueryClient
This commit is contained in:
cv
2021-04-24 15:05:18 +02:00
parent e8bca40653
commit 3f8c6f1192
6 changed files with 32 additions and 15 deletions
+5
View File
@@ -4,6 +4,7 @@ import Editor from './features/editors/Editor';
import DefaultPresenter from './features/viewers/DefaultPresenter';
import PresenterView from './features/viewers/presenter/PresenterView';
import { QueryClient, QueryClientProvider } from 'react-query';
import { broadcastQueryClient } from 'react-query/broadcastQueryClient-experimental';
import SocketProvider from './app/context/socketContext';
import PresenterSimple from './features/viewers/presenter/PresenterSimple';
import StageManager from './features/viewers/backstage/StageManager';
@@ -11,6 +12,10 @@ import withSocket from './features/viewers/ViewWrapper';
import Lower from './features/viewers/lower/Lower';
const queryClient = new QueryClient();
broadcastQueryClient({
queryClient,
broadcastChannel: 'ontime',
});
const SDefault = withSocket(DefaultPresenter);
const SSpeaker = withSocket(PresenterView);