@the-portland-company/shell 0.102.1 → 0.102.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.102.2
2
+
3
+ Every org's icon shows in the org switcher, in every app (bug seen live 2026-11-15, Ben: switching orgs from Relationship Mode → Email, "not every org icon displayed").
4
+
5
+ - **Cause.** Apps that pass their own switcher list (`tokenOrg.orgs`) make the shell skip its `/api/orgs` read. Most of them merge branding with a copied helper that keeps only `logoUrl` and `brandColor`, so the Brand Kit icon (`iconUrl`) never reached the switcher and an org without a Primary logo showed initials.
6
+ - **Fix.** When any row of `tokenOrg.orgs` has no `iconUrl` key, the shell reads the chrome org list too (de-duped, fail-soft) and fills each row's missing icon, logo and brand color by org id. The app's own values win, and rows are never added, removed or reordered. Apps whose rows carry `iconUrl` (even `null`) are left as they are, with no extra read. New export on `./app-chrome`: `fillOrgBranding(rows, chromeOrgs)`.
7
+ - Tests: `__tests__/switcherOrgBranding.test.tsx` (new); `activeOrgV2` now passes branded rows for its no-read case.
8
+
1
9
  ## 0.102.1
2
10
 
3
11
  The Credits tooltip's gauges stay inside the tooltip (bug seen live 2026-11-15, Ben: "the credits tooltip has gauges extending past the container").
@@ -4734,12 +4734,27 @@ var ChromeStateContext = react.createContext(null);
4734
4734
  function useChromeState() {
4735
4735
  return react.useContext(ChromeStateContext);
4736
4736
  }
4737
+ function fillOrgBranding(rows, chrome) {
4738
+ if (!chrome?.length) return rows;
4739
+ const byId = new Map(chrome.map((o) => [o.id, o]));
4740
+ return rows.map((row) => {
4741
+ const c = byId.get(row.id);
4742
+ if (!c) return row;
4743
+ return {
4744
+ ...row,
4745
+ iconUrl: row.iconUrl || c.iconUrl || null,
4746
+ logoUrl: row.logoUrl || c.logoUrl || null,
4747
+ brandColor: row.brandColor || c.brandColor || null
4748
+ };
4749
+ });
4750
+ }
4737
4751
  function TokenChromeStateProvider({
4738
4752
  tokenOrg,
4739
4753
  children
4740
4754
  }) {
4755
+ const needsBranding = !!tokenOrg.orgs?.some((o) => o.iconUrl === void 0);
4741
4756
  const { orgs: fetchedOrgs, loading: orgsFetching, error: orgsError } = useChromeOrgs({
4742
- enabled: !tokenOrg.orgs
4757
+ enabled: !tokenOrg.orgs || needsBranding
4743
4758
  });
4744
4759
  const [navDisplay, setNavDisplayState] = react.useState(NAV_DISPLAY_DEFAULT);
4745
4760
  const [pendingOrg, setPendingOrg] = react.useState(null);
@@ -4750,7 +4765,7 @@ function TokenChromeStateProvider({
4750
4765
  setNavDisplayState(resolveNavDisplay());
4751
4766
  }, []);
4752
4767
  const orgs = react.useMemo(
4753
- () => tokenOrg.orgs ?? (fetchedOrgs ?? []).map((o) => ({
4768
+ () => (tokenOrg.orgs ? fillOrgBranding(tokenOrg.orgs, fetchedOrgs) : null) ?? (fetchedOrgs ?? []).map((o) => ({
4754
4769
  id: o.id,
4755
4770
  name: o.name,
4756
4771
  logoUrl: o.logoUrl,
@@ -5426,6 +5441,7 @@ exports.POLITOGY_APPS = POLITOGY_APPS;
5426
5441
  exports.PolitogyAppChrome = PolitogyAppChrome;
5427
5442
  exports.PolitogyAppFrame = PolitogyAppFrame;
5428
5443
  exports.deriveBreadcrumbs = deriveBreadcrumbs;
5444
+ exports.fillOrgBranding = fillOrgBranding;
5429
5445
  exports.footerLinks = footerLinks;
5430
5446
  exports.looksLikeEmail = looksLikeEmail;
5431
5447
  exports.modeLandingHref = modeLandingHref;