azirid-react 0.10.2 → 0.10.3

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/README.md CHANGED
@@ -376,6 +376,8 @@ import { useBootstrap } from 'azirid-react'
376
376
  const { bootstrap, isBootstrapping } = useBootstrap()
377
377
  ```
378
378
 
379
+ > **Note:** The automatic bootstrap on mount runs exactly once, even in React 18 Strict Mode (which double-mounts components in development). Hooks like `usePayphoneCheckout` and `<PayphoneCallback>` wait for bootstrap to complete before making authenticated requests.
380
+
379
381
  ### `useRefresh`
380
382
 
381
383
  Manually refresh the access token.
@@ -1297,7 +1299,7 @@ function createAccessClient(
1297
1299
  | `publishableKey` | `string` | — | Publishable key (e.g. `pk_live_...`) |
1298
1300
  | `tenantId` | `string` | — | Tenant ID for multi-tenant apps |
1299
1301
  | `fetchOptions` | `Record<string, string>` | — | Extra headers to send with every request |
1300
- | `autoBootstrap` | `boolean` | `true` | Auto-restore session on mount |
1302
+ | `autoBootstrap` | `boolean` | `true` | Auto-restore session on mount. Runs once (safe in React 18 Strict Mode) |
1301
1303
  | `refreshInterval` | `number` | `50000` | Token refresh interval in ms. `0` to disable |
1302
1304
  | `sessionSyncUrl` | `string \| false` | auto | URL for session cookie sync. Auto-activates in dev mode. Pass `false` to disable |
1303
1305
  | `onAuthStateChange`| `() => void` | — | Called after login, signup, or logout. **In Next.js, pass `router.refresh()`** to sync server actions with updated cookies |
package/dist/index.cjs CHANGED
@@ -768,9 +768,15 @@ function AziridProviderInner({
768
768
  },
769
769
  [client]
770
770
  );
771
+ const bootstrapCalled = react.useRef(false);
771
772
  react.useEffect(() => {
772
773
  const autoBootstrap = props.autoBootstrap ?? true;
773
774
  if (!autoBootstrap) return;
775
+ if (bootstrapCalled.current) {
776
+ setIsBootstrapping(false);
777
+ return;
778
+ }
779
+ bootstrapCalled.current = true;
774
780
  let cancelled = false;
775
781
  async function bootstrap() {
776
782
  setIsBootstrapping(true);
@@ -4349,7 +4355,7 @@ function usePasswordToggle() {
4349
4355
  }
4350
4356
 
4351
4357
  // src/index.ts
4352
- var SDK_VERSION = "0.10.2";
4358
+ var SDK_VERSION = "0.10.3";
4353
4359
 
4354
4360
  exports.AuthForm = AuthForm;
4355
4361
  exports.AziridProvider = AziridProvider;