@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.
@@ -1 +1 @@
1
- {"version":3,"file":"PasskeymeCallbackHandler.d.ts","sourceRoot":"","sources":["../../src/components/PasskeymeCallbackHandler.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAuLzD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iBAAiB,EAAE,GAAG,GAAG,IAAI,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,wBAAwB,GAAI,sIAQtC,6BAA6B,mDAu3B/B,CAAC"}
1
+ {"version":3,"file":"PasskeymeCallbackHandler.d.ts","sourceRoot":"","sources":["../../src/components/PasskeymeCallbackHandler.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAuLzD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iBAAiB,EAAE,GAAG,GAAG,IAAI,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,wBAAwB,GAAI,sIAQtC,6BAA6B,mDAs3B/B,CAAC"}
package/dist/index.esm.js CHANGED
@@ -6686,11 +6686,14 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
6686
6686
  };
6687
6687
  // Proceed with redirect after auth completion
6688
6688
  const proceedWithRedirect = async () => {
6689
+ // CRITICAL: Clean URL synchronously BEFORE any async operations
6690
+ // This prevents Next.js App Router from remounting the component with stale URL params
6691
+ // Must happen outside setTimeout to execute immediately
6692
+ window.history.replaceState({}, document.title, window.location.pathname);
6689
6693
  setTimeout(async () => {
6690
6694
  const currentUser = state.authenticatedUser || user;
6691
6695
  if (onSuccess && currentUser) {
6692
- // For custom callbacks, execute immediately without URL cleanup
6693
- // The parent component should handle navigation after the callback
6696
+ // For custom callbacks, parent component handles navigation
6694
6697
  try {
6695
6698
  const token = await auth.getAccessToken();
6696
6699
  onSuccess(currentUser, token || "");
@@ -6701,8 +6704,7 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
6701
6704
  }
6702
6705
  }
6703
6706
  else {
6704
- // For redirects, clean URL before navigating away
6705
- window.history.replaceState({}, document.title, window.location.pathname);
6707
+ // For redirects, navigate to success page
6706
6708
  window.location.href = successRedirect;
6707
6709
  }
6708
6710
  }, 100);