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
@@ -1,4 +1,4 @@
import { useMutation, useQuery, useQueryClient } from 'react-query';
import { useMutation, useQueryClient } from 'react-query';
import { useEffect } from 'react';
import {
eventsNamespace,
@@ -13,10 +13,11 @@ import EventListMenu from '../../menu/EventListMenu.jsx';
import { showErrorToast } from '../../../common/helpers/toastManager';
import { Skeleton } from '@chakra-ui/skeleton';
import style from './List.module.css';
import { useFetch } from '../../../app/hooks/useFetch.js';
export default function EventListWrapper() {
const queryClient = useQueryClient();
const { data, status, isError, refetch } = useQuery(
const { data, status, isError, refetch } = useFetch(
eventsNamespace,
fetchAllEvents
);