@passkeyme/react-auth 2.2.5 → 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,mDAo3B/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,12 +6686,14 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
6686
6686
  };
6687
6687
  // Proceed with redirect after auth completion
6688
6688
  const proceedWithRedirect = async () => {
6689
- // Clean URL immediately to prevent effect re-run with stale URL params
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
6690
6692
  window.history.replaceState({}, document.title, window.location.pathname);
6691
6693
  setTimeout(async () => {
6692
6694
  const currentUser = state.authenticatedUser || user;
6693
6695
  if (onSuccess && currentUser) {
6694
- // Use auth's getAccessToken method instead of direct localStorage access
6696
+ // For custom callbacks, parent component handles navigation
6695
6697
  try {
6696
6698
  const token = await auth.getAccessToken();
6697
6699
  onSuccess(currentUser, token || "");
@@ -6702,7 +6704,7 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
6702
6704
  }
6703
6705
  }
6704
6706
  else {
6705
- // Redirect to success page
6707
+ // For redirects, navigate to success page
6706
6708
  window.location.href = successRedirect;
6707
6709
  }
6708
6710
  }, 100);