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

This commit is contained in:
Benny Joo
2024-12-20 18:44:35 +00:00
committed by GitHub
parent e04faffcbb
commit cafa3f9cf3
+4
View File
@@ -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;