Skip to content

Scheduling infrastructure for absolutely everyone.

fix: make sure to call refresh for pages rendered by app router (#18304)

Benny Joocafa3f9cf386
diff --git a/packages/lib/hooks/useRefreshData.ts b/packages/lib/hooks/useRefreshData.ts
index 0040b5dd7fe..d505af074d5 100644
--- a/packages/lib/hooks/useRefreshData.ts
+++ b/packages/lib/hooks/useRefreshData.ts
@@ -7,6 +7,10 @@ export function useRefreshData() {
const router = useRouter();
const asPath = useAsPath();
const refreshData = () => {
+ if ("refresh" in router) {
+ // Refresh the server components
+ router.refresh();
+ }
router.replace(asPath);
};
return refreshData;