diff --git a/src/App.tsx b/src/App.tsx index b64a36d9..4cc84b73 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -16,7 +16,9 @@ import '../leaflet.config.js' import { FeatureProvider } from './components/useFeature' const App: FC = () => { - const queryClient = new QueryClient() + const queryClient = new QueryClient({ + defaultOptions: { queries: { staleTime: 60 * 1000 } }, + }) return ( diff --git a/src/components/message/MessageList.tsx b/src/components/message/MessageList.tsx index 8f174a94..bb257861 100644 --- a/src/components/message/MessageList.tsx +++ b/src/components/message/MessageList.tsx @@ -13,10 +13,8 @@ interface Props { const MessageList: FC = ({ ticker }) => { const { token } = useAuth() const { getMessages } = useMessageApi(token) - const { isLoading, error, data } = useQuery( - ['messages', ticker.id], - () => getMessages(ticker.id), - { refetchInterval: false } + const { isLoading, error, data } = useQuery(['messages', ticker.id], () => + getMessages(ticker.id) ) if (isLoading) { diff --git a/src/components/settings/InactiveSettingsCard.tsx b/src/components/settings/InactiveSettingsCard.tsx index e10563e5..6aba75f2 100644 --- a/src/components/settings/InactiveSettingsCard.tsx +++ b/src/components/settings/InactiveSettingsCard.tsx @@ -20,10 +20,7 @@ const InactiveSettingsCard: FC = () => { const { getInactiveSettings } = useSettingsApi(token) const { isLoading, error, data } = useQuery( ['inactive_settings'], - getInactiveSettings, - { - refetchInterval: false, - } + getInactiveSettings ) if (isLoading) { diff --git a/src/components/settings/RefreshIntervalCard.tsx b/src/components/settings/RefreshIntervalCard.tsx index 3316fc02..040f7a1b 100644 --- a/src/components/settings/RefreshIntervalCard.tsx +++ b/src/components/settings/RefreshIntervalCard.tsx @@ -11,10 +11,7 @@ const RefreshIntervalCard: FC = () => { const { getRefreshInterval } = useSettingsApi(token) const { isLoading, error, data } = useQuery( ['refresh_interval_setting'], - getRefreshInterval, - { - refetchInterval: false, - } + getRefreshInterval ) if (isLoading) { diff --git a/src/components/ticker/TickerUserCard.tsx b/src/components/ticker/TickerUserCard.tsx index 3233ac2a..8fea888a 100644 --- a/src/components/ticker/TickerUserCard.tsx +++ b/src/components/ticker/TickerUserCard.tsx @@ -17,9 +17,6 @@ const TickerUsersCard: FC = props => { ['tickerUsers', props.ticker.id], () => { return getTickerUsers(props.ticker) - }, - { - refetchInterval: false, } ) diff --git a/src/components/user/UserList.tsx b/src/components/user/UserList.tsx index 89d1ccd6..05afcd41 100644 --- a/src/components/user/UserList.tsx +++ b/src/components/user/UserList.tsx @@ -10,9 +10,7 @@ import ErrorView from '../../views/ErrorView' const UserList: FC = () => { const { token } = useAuth() const { getUsers } = useUserApi(token) - const { isLoading, error, data } = useQuery(['users'], getUsers, { - refetchInterval: false, - }) + const { isLoading, error, data } = useQuery(['users'], getUsers) if (isLoading) { return ( diff --git a/src/views/HomeView.tsx b/src/views/HomeView.tsx index 87be8c74..5755078d 100644 --- a/src/views/HomeView.tsx +++ b/src/views/HomeView.tsx @@ -19,9 +19,7 @@ import { Navigate } from 'react-router' const HomeView: FC = () => { const { token, user } = useAuth() const { getTickers } = useTickerApi(token) - const { isLoading, error, data } = useQuery(['tickers'], getTickers, { - refetchInterval: false, - }) + const { isLoading, error, data } = useQuery(['tickers'], getTickers) if (isLoading) { return ( diff --git a/src/views/TickerView.tsx b/src/views/TickerView.tsx index 1919eb18..12e87a2e 100644 --- a/src/views/TickerView.tsx +++ b/src/views/TickerView.tsx @@ -18,10 +18,8 @@ const TickerView: FC = () => { const { tickerId } = useParams() as TickerViewParams const tickerIdNum = parseInt(tickerId) - const { isLoading, error, data } = useQuery( - ['ticker', tickerIdNum], - () => getTicker(tickerIdNum), - { refetchInterval: false } + const { isLoading, error, data } = useQuery(['ticker', tickerIdNum], () => + getTicker(tickerIdNum) ) if (isLoading) {