@the-portland-company/shell 0.35.0 → 0.35.1

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.
@@ -1569,9 +1569,25 @@ function NavSidebar({
1569
1569
  org ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-3", children: [
1570
1570
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2 flex items-center justify-between px-1", children: [
1571
1571
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[11px] font-semibold uppercase tracking-[0.08em] text-[color:var(--muted)]", children: "Organization" }),
1572
- org.id ? /* @__PURE__ */ jsxRuntime.jsx(OrgIdCopyButton, { id: org.id }) : null
1572
+ org.id && !org.loading ? /* @__PURE__ */ jsxRuntime.jsx(OrgIdCopyButton, { id: org.id }) : null
1573
1573
  ] }),
1574
- org.organizations && org.organizations.length > 0 && org.onSwitch ? /* @__PURE__ */ jsxRuntime.jsxs("details", { "data-nav-details": true, className: "group relative", children: [
1574
+ org.loading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full items-center gap-2.5 rounded-md border border-[color:var(--line)] bg-[color:var(--panel-elevated)] px-2.5 py-2 shadow-sm", children: [
1575
+ /* @__PURE__ */ jsxRuntime.jsx(
1576
+ "span",
1577
+ {
1578
+ "aria-hidden": true,
1579
+ className: "h-7 w-7 shrink-0 animate-pulse rounded-full bg-[color:var(--panel)]"
1580
+ }
1581
+ ),
1582
+ /* @__PURE__ */ jsxRuntime.jsx(
1583
+ "span",
1584
+ {
1585
+ "aria-hidden": true,
1586
+ className: "h-4 flex-1 animate-pulse rounded bg-[color:var(--panel)]"
1587
+ }
1588
+ ),
1589
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Loading organization" })
1590
+ ] }) : org.organizations && org.organizations.length > 0 && org.onSwitch ? /* @__PURE__ */ jsxRuntime.jsxs("details", { "data-nav-details": true, className: "group relative", children: [
1575
1591
  /* @__PURE__ */ jsxRuntime.jsxs("summary", { className: "flex w-full cursor-pointer list-none items-center justify-between gap-2 rounded-md border border-[color:var(--line)] bg-[color:var(--panel-elevated)] px-2.5 py-2 text-left text-[color:var(--foreground)] shadow-sm transition hover:bg-[color:var(--panel)] [&::-webkit-details-marker]:hidden", children: [
1576
1592
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-center gap-2.5", children: [
1577
1593
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2604,6 +2620,11 @@ function FrameBody({
2604
2620
  nav: {
2605
2621
  items: navDisplay === "tabs" ? navItems.map(({ children: _sub, ...item }) => item) : navItems
2606
2622
  },
2623
+ // The app's own workspace is NOT the organization — it is a per-app
2624
+ // bootstrap account with a different id in every app. Showing it while
2625
+ // the chrome API resolves flashed the wrong org on every load ("not
2626
+ // connected to the account"). Shimmer while in flight; only fall back
2627
+ // to the app label once the chrome lookup has actually failed.
2607
2628
  org: activeCoreOrg ? {
2608
2629
  name: activeCoreOrg.name,
2609
2630
  id: activeCoreOrg.id,
@@ -2611,7 +2632,7 @@ function FrameBody({
2611
2632
  brandColor: activeCoreOrg.brandColor,
2612
2633
  organizations: coreOrgs,
2613
2634
  onSwitch: chrome?.setOrgId
2614
- } : { name: session.accountName, id: session.accountId },
2635
+ } : chrome?.orgsLoading ? { name: null, id: null, loading: true } : { name: session.accountName, id: session.accountId },
2615
2636
  mode,
2616
2637
  footer,
2617
2638
  linkComponent
@@ -2686,7 +2707,7 @@ function ChromeStateProvider({
2686
2707
  controlledOrg,
2687
2708
  children
2688
2709
  }) {
2689
- const { orgs } = useChromeOrgs();
2710
+ const { orgs, loading: orgsFetching, error: orgsError } = useChromeOrgs();
2690
2711
  const [orgId, setOrgIdState] = react.useState(null);
2691
2712
  const [navDisplay, setNavDisplayState] = react.useState("both");
2692
2713
  react.useEffect(() => {
@@ -2731,6 +2752,7 @@ function ChromeStateProvider({
2731
2752
  role: o.role,
2732
2753
  rawRole: o.rawRole ?? null
2733
2754
  })),
2755
+ orgsLoading: false,
2734
2756
  navDisplay,
2735
2757
  setNavDisplay
2736
2758
  };
@@ -2746,10 +2768,13 @@ function ChromeStateProvider({
2746
2768
  role: o.role,
2747
2769
  rawRole: o.rawRole ?? null
2748
2770
  })),
2771
+ // Loading until the fetch settles. On error we stop loading so the frame
2772
+ // falls back to the app label rather than shimmering forever.
2773
+ orgsLoading: orgsFetching && !orgsError && !orgs,
2749
2774
  navDisplay,
2750
2775
  setNavDisplay
2751
2776
  };
2752
- }, [controlledOrg, orgId, setOrgId, orgs, navDisplay, setNavDisplay]);
2777
+ }, [controlledOrg, orgId, setOrgId, orgs, orgsFetching, orgsError, navDisplay, setNavDisplay]);
2753
2778
  return /* @__PURE__ */ jsxRuntime.jsx(ChromeStateContext.Provider, { value, children });
2754
2779
  }
2755
2780
  function AppDevNotes({