Files
calendar/packages/lib/hooks/useRefreshData.ts
T
Omar LópezandGitHub 6dd8812a19 fix: Flakyness on pages that use a hard refresh (#16752)
* fix: Flakyness on pages that use a hard refres

Signed-off-by: zomars <zomars@me.com>

* Update Shell.tsx

---------

Signed-off-by: zomars <zomars@me.com>
2024-09-21 03:41:10 +00:00

14 lines
347 B
TypeScript

import { useRouter } from "next/navigation";
import { useAsPath } from "./useAsPath";
/** @see https://www.joshwcomeau.com/nextjs/refreshing-server-side-props/ */
export function useRefreshData() {
const router = useRouter();
const asPath = useAsPath();
const refreshData = () => {
router.replace(asPath);
};
return refreshData;
}