* 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>
14 lines
347 B
TypeScript
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;
|
|
}
|