diff --git a/v2/emailpassword/nextjs/app-directory/protecting-route.mdx b/v2/emailpassword/nextjs/app-directory/protecting-route.mdx
index dc707715d..156ee64b0 100644
--- a/v2/emailpassword/nextjs/app-directory/protecting-route.mdx
+++ b/v2/emailpassword/nextjs/app-directory/protecting-route.mdx
@@ -154,7 +154,7 @@ export const TryRefreshComponent = () => {
.catch(() => {
setDidError(true);
});
- }, []);
+ }, [router]);
/**
* We add this check to make sure we handle the case where the refresh API fails with
@@ -310,7 +310,7 @@ export const TryRefreshComponent = () => {
.catch(() => {
setDidError(true);
});
- }, []);
+ }, [router]);
if (didError) {
return
Something went wrong, please reload the page
;
diff --git a/v2/passwordless/nextjs/app-directory/protecting-route.mdx b/v2/passwordless/nextjs/app-directory/protecting-route.mdx
index dc707715d..156ee64b0 100644
--- a/v2/passwordless/nextjs/app-directory/protecting-route.mdx
+++ b/v2/passwordless/nextjs/app-directory/protecting-route.mdx
@@ -154,7 +154,7 @@ export const TryRefreshComponent = () => {
.catch(() => {
setDidError(true);
});
- }, []);
+ }, [router]);
/**
* We add this check to make sure we handle the case where the refresh API fails with
@@ -310,7 +310,7 @@ export const TryRefreshComponent = () => {
.catch(() => {
setDidError(true);
});
- }, []);
+ }, [router]);
if (didError) {
return Something went wrong, please reload the page
;
diff --git a/v2/thirdparty/nextjs/app-directory/protecting-route.mdx b/v2/thirdparty/nextjs/app-directory/protecting-route.mdx
index dc707715d..156ee64b0 100644
--- a/v2/thirdparty/nextjs/app-directory/protecting-route.mdx
+++ b/v2/thirdparty/nextjs/app-directory/protecting-route.mdx
@@ -154,7 +154,7 @@ export const TryRefreshComponent = () => {
.catch(() => {
setDidError(true);
});
- }, []);
+ }, [router]);
/**
* We add this check to make sure we handle the case where the refresh API fails with
@@ -310,7 +310,7 @@ export const TryRefreshComponent = () => {
.catch(() => {
setDidError(true);
});
- }, []);
+ }, [router]);
if (didError) {
return Something went wrong, please reload the page
;
diff --git a/v2/thirdpartyemailpassword/nextjs/app-directory/protecting-route.mdx b/v2/thirdpartyemailpassword/nextjs/app-directory/protecting-route.mdx
index 7d7ed7383..a5c16793d 100644
--- a/v2/thirdpartyemailpassword/nextjs/app-directory/protecting-route.mdx
+++ b/v2/thirdpartyemailpassword/nextjs/app-directory/protecting-route.mdx
@@ -155,7 +155,7 @@ export const TryRefreshComponent = () => {
.catch(() => {
setDidError(true);
});
- }, []);
+ }, [router]);
/**
* We add this check to make sure we handle the case where the refresh API fails with
@@ -311,7 +311,7 @@ export const TryRefreshComponent = () => {
.catch(() => {
setDidError(true);
});
- }, []);
+ }, [router]);
if (didError) {
return Something went wrong, please reload the page
;
diff --git a/v2/thirdpartypasswordless/nextjs/app-directory/protecting-route.mdx b/v2/thirdpartypasswordless/nextjs/app-directory/protecting-route.mdx
index dc707715d..156ee64b0 100644
--- a/v2/thirdpartypasswordless/nextjs/app-directory/protecting-route.mdx
+++ b/v2/thirdpartypasswordless/nextjs/app-directory/protecting-route.mdx
@@ -154,7 +154,7 @@ export const TryRefreshComponent = () => {
.catch(() => {
setDidError(true);
});
- }, []);
+ }, [router]);
/**
* We add this check to make sure we handle the case where the refresh API fails with
@@ -310,7 +310,7 @@ export const TryRefreshComponent = () => {
.catch(() => {
setDidError(true);
});
- }, []);
+ }, [router]);
if (didError) {
return Something went wrong, please reload the page
;