From 18999357a8740281d4073c71d964e48b48459bad Mon Sep 17 00:00:00 2001 From: Aarnav Tale Date: Wed, 15 May 2024 21:53:12 -0400 Subject: [PATCH] fix: return the revalidator in useLiveData --- app/utils/useLiveData.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/utils/useLiveData.ts b/app/utils/useLiveData.ts index e3e1793..c7a861f 100644 --- a/app/utils/useLiveData.ts +++ b/app/utils/useLiveData.ts @@ -2,11 +2,11 @@ import { useRevalidator } from '@remix-run/react' import { useEffect } from 'react' import { useInterval } from 'usehooks-ts' -type Properties = { - interval: number; +interface Props { + interval: number } -export function useLiveData({ interval }: Properties) { +export function useLiveData({ interval }: Props) { const revalidator = useRevalidator() // Handle normal stale-while-revalidate behavior @@ -31,4 +31,5 @@ export function useLiveData({ interval }: Properties) { document.removeEventListener('focus', handler) } }, [revalidator]) + return revalidator }