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

This commit is contained in:
Benny Joo authored and GitHub committed 2024-12-20 18:44:35 +00:00
1 parent e04faffcbb
commit cafa3f9cf3
1 file changed
+4
+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;