@isomorph.ai/app-sdk 1.11.0 → 1.12.0

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.
Files changed (2) hide show
  1. package/dist/index.js +13 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -492,6 +492,19 @@ export function createClient(options = {}) {
492
492
  },
493
493
  };
494
494
  }
495
+ // A kit page on its own API host pays for its first call three times over:
496
+ // a fresh connection (TCP, TLS, then a CORS preflight), the 401 → context
497
+ // refresh → resend detour once the context cookie has lapsed, and only then
498
+ // the call. Sending the identity GET now — the one the API host heals — opens
499
+ // the connection, renews a lapsed context and caches the user while the page
500
+ // is still rendering, so the first action rides an open connection with a
501
+ // live context; a refusal while it is in flight shares it (renew above). A
502
+ // page-relative base (isomorph dev, a git app on the shared edge) already has
503
+ // its connection and the edge heals its GETs, so nothing is sent there, and
504
+ // under Node the identity is a static token. Its outcome is the page's to
505
+ // read through identity.current() and onChange, never surfaced here.
506
+ if (transport.separateApiHost)
507
+ void refreshIdentity().catch(() => undefined);
495
508
  const scheduleIdentityRefresh = () => {
496
509
  if (refreshTimer !== undefined || authListeners.size === 0 || identityRefreshMs <= 0)
497
510
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isomorph.ai/app-sdk",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",