@pylonsync/client 0.3.280 → 0.3.282

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.3.280",
6
+ "version": "0.3.282",
7
7
  "type": "module",
8
8
  "main": "src/index.ts",
9
9
  "types": "src/index.ts",
@@ -19,8 +19,8 @@
19
19
  "check": "tsc -p tsconfig.json --noEmit"
20
20
  },
21
21
  "dependencies": {
22
- "@pylonsync/react": "0.3.280",
23
- "@pylonsync/sync": "0.3.280",
22
+ "@pylonsync/react": "0.3.282",
23
+ "@pylonsync/sync": "0.3.282",
24
24
  "clsx": "^2.1.1"
25
25
  },
26
26
  "peerDependencies": {
@@ -26,7 +26,7 @@ export interface OrganizationSwitcherProps {
26
26
  /** Called after a switch lands. Useful for analytics / route changes. */
27
27
  onSwitched?: (orgId: string | null) => void;
28
28
  /** Called after a new org is created (post-creation, pre-switch). */
29
- onCreated?: (org: OrgSummary) => void;
29
+ onCreated?: (org: OrgSummary) => void | Promise<void>;
30
30
  /**
31
31
  * Active org name resolved on the server (e.g. `serverData.get("Org", …)`
32
32
  * in an SSR layout). Seeds the trigger label so it renders the real name on
@@ -281,7 +281,7 @@ function CreateOrgInline({
281
281
  onCreated,
282
282
  onCancel,
283
283
  }: {
284
- onCreated: (org: OrgSummary) => void;
284
+ onCreated: (org: OrgSummary) => void | Promise<void>;
285
285
  onCancel: () => void;
286
286
  }) {
287
287
  return (
@@ -303,7 +303,7 @@ function CreateOrgInline({
303
303
  // ---------------------------------------------------------------------------
304
304
 
305
305
  export interface CreateOrganizationProps {
306
- onCreated?: (org: OrgSummary) => void;
306
+ onCreated?: (org: OrgSummary) => void | Promise<void>;
307
307
  /** Title shown above the form. */
308
308
  title?: ReactNode;
309
309
  className?: string;
@@ -332,7 +332,7 @@ export function CreateOrganization({
332
332
  function CreateOrganizationForm({
333
333
  onCreated,
334
334
  }: {
335
- onCreated?: (org: OrgSummary) => void;
335
+ onCreated?: (org: OrgSummary) => void | Promise<void>;
336
336
  }) {
337
337
  const [name, setName] = useState("");
338
338
  const [error, setError] = useState<string | null>(null);
@@ -350,7 +350,10 @@ function CreateOrganizationForm({
350
350
  try {
351
351
  const org = await createOrg(trimmed);
352
352
  setName("");
353
- onCreated?.(org);
353
+ // Await the callback so anything it does (selectOrg, navigation,
354
+ // step advance) that rejects surfaces here as an error instead of
355
+ // an unhandled rejection that leaves the form looking inert.
356
+ await onCreated?.(org);
354
357
  } catch (err) {
355
358
  setError(messageFromError(err));
356
359
  } finally {