@passkeyme/react-auth 2.2.6 → 2.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -6687,11 +6687,14 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
|
|
|
6687
6687
|
};
|
|
6688
6688
|
// Proceed with redirect after auth completion
|
|
6689
6689
|
const proceedWithRedirect = async () => {
|
|
6690
|
+
// CRITICAL: Clean URL synchronously BEFORE any async operations
|
|
6691
|
+
// This prevents Next.js App Router from remounting the component with stale URL params
|
|
6692
|
+
// Must happen outside setTimeout to execute immediately
|
|
6693
|
+
window.history.replaceState({}, document.title, window.location.pathname);
|
|
6690
6694
|
setTimeout(async () => {
|
|
6691
6695
|
const currentUser = state.authenticatedUser || user;
|
|
6692
6696
|
if (onSuccess && currentUser) {
|
|
6693
|
-
// For custom callbacks,
|
|
6694
|
-
// The parent component should handle navigation after the callback
|
|
6697
|
+
// For custom callbacks, parent component handles navigation
|
|
6695
6698
|
try {
|
|
6696
6699
|
const token = await auth.getAccessToken();
|
|
6697
6700
|
onSuccess(currentUser, token || "");
|
|
@@ -6702,8 +6705,7 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
|
|
|
6702
6705
|
}
|
|
6703
6706
|
}
|
|
6704
6707
|
else {
|
|
6705
|
-
// For redirects,
|
|
6706
|
-
window.history.replaceState({}, document.title, window.location.pathname);
|
|
6708
|
+
// For redirects, navigate to success page
|
|
6707
6709
|
window.location.href = successRedirect;
|
|
6708
6710
|
}
|
|
6709
6711
|
}, 100);
|