@the-portland-company/shell 0.75.2 → 0.76.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.
@@ -249,6 +249,9 @@ function useChromeMe() {
249
249
  const ctx = useContext(NavChromeContext);
250
250
  return { me: ctx?.me ?? null, loaded: ctx?.meLoaded ?? false };
251
251
  }
252
+ function useNavChromeDedupedFetch() {
253
+ return useContext(NavChromeContext)?.dedupedFetch ?? null;
254
+ }
252
255
  function useNavChromeFetcher() {
253
256
  return useContext(NavChromeContext)?.fetchJson ?? null;
254
257
  }
@@ -261,12 +264,16 @@ function useNavChrome(component) {
261
264
  }
262
265
  return ctx;
263
266
  }
264
- function useChromeOrgs() {
267
+ function useChromeOrgs({ enabled = true } = {}) {
265
268
  const { dedupedFetch } = useNavChrome("useChromeOrgs");
266
269
  const [orgs, setOrgs] = useState(null);
267
- const [loading, setLoading] = useState(true);
270
+ const [loading, setLoading] = useState(enabled);
268
271
  const [error, setError] = useState(false);
269
272
  useEffect(() => {
273
+ if (!enabled) {
274
+ setLoading(false);
275
+ return;
276
+ }
270
277
  let cancelled = false;
271
278
  setLoading(true);
272
279
  setError(false);
@@ -282,7 +289,7 @@ function useChromeOrgs() {
282
289
  return () => {
283
290
  cancelled = true;
284
291
  };
285
- }, [dedupedFetch]);
292
+ }, [dedupedFetch, enabled]);
286
293
  return { orgs, loading, error };
287
294
  }
288
295
  function ValueSkeleton({ className }) {
@@ -572,6 +579,10 @@ function FuelAction({ orgId }) {
572
579
  const [error, setError] = useState(false);
573
580
  useEffect(() => {
574
581
  let cancelled = false;
582
+ if (!orgId) {
583
+ setLoading(false);
584
+ return;
585
+ }
575
586
  setLoading(true);
576
587
  setError(false);
577
588
  setFuel(null);
@@ -807,6 +818,10 @@ function NotificationsAction({ orgId }) {
807
818
  }, [orgId]);
808
819
  useEffect(() => {
809
820
  let cancelled = false;
821
+ if (!orgId) {
822
+ setLoading(false);
823
+ return;
824
+ }
810
825
  setLoading(true);
811
826
  setError(false);
812
827
  setPayload(null);
@@ -1046,10 +1061,14 @@ function composeSupportMessage(input) {
1046
1061
  ---
1047
1062
  ${ctx.join("\n")}`;
1048
1063
  }
1049
- function SupportAction({ orgId } = {}) {
1064
+ function SupportAction({
1065
+ orgId,
1066
+ orgs: knownOrgs
1067
+ } = {}) {
1050
1068
  const { fetchJson } = useNavChrome("SupportAction");
1051
1069
  const { me, loaded } = useChromeMe();
1052
- const { orgs } = useChromeOrgs();
1070
+ const { orgs: fetchedOrgs } = useChromeOrgs({ enabled: !knownOrgs });
1071
+ const orgs = knownOrgs ?? fetchedOrgs;
1053
1072
  const [open, setOpen] = useState(false);
1054
1073
  const [message, setMessage] = useState("");
1055
1074
  const [email, setEmail] = useState("");
@@ -3648,6 +3667,6 @@ function NavAppShell({
3648
3667
  );
3649
3668
  }
3650
3669
 
3651
- export { BETA_BANNER_DISMISS_KEY, CAMPAIGN_FEATURE_AVAILABILITY, CORE_APP_ORIGIN, CORE_BILLING_PATH, FuelAction, NavAppShell, NavBetaBanner, NavChromeProvider, NavDisplayAction, NavSidebar, NavTabStrip, NavThemeControl, NavTopBar, NotificationsAction, SPECS_ORIGIN, SpecOverlayAction, SupportAction, TopBarCountBadge, TopBarPanelArrow, TopBarPopover, TopBarTooltip, TopBarWidgetSlot, clearBetaBannerDismissal, envChipClasses, isNavItemActive, modeIdFromLabel, resolveOrgLogoUrl, shortEnvLabel, shortUserName, standardNavIcons, standardPolitogyNav, topBarIconButtonClass, useChromeMe, useChromeOrgs, useNavChromeFetcher, useThemePreference };
3652
- //# sourceMappingURL=chunk-2DXTSTII.js.map
3653
- //# sourceMappingURL=chunk-2DXTSTII.js.map
3670
+ export { BETA_BANNER_DISMISS_KEY, CAMPAIGN_FEATURE_AVAILABILITY, CORE_APP_ORIGIN, CORE_BILLING_PATH, FuelAction, NavAppShell, NavBetaBanner, NavChromeProvider, NavDisplayAction, NavSidebar, NavTabStrip, NavThemeControl, NavTopBar, NotificationsAction, SPECS_ORIGIN, SpecOverlayAction, SupportAction, TopBarCountBadge, TopBarPanelArrow, TopBarPopover, TopBarTooltip, TopBarWidgetSlot, clearBetaBannerDismissal, envChipClasses, isNavItemActive, modeIdFromLabel, resolveOrgLogoUrl, shortEnvLabel, shortUserName, standardNavIcons, standardPolitogyNav, topBarIconButtonClass, useChromeMe, useChromeOrgs, useNavChromeDedupedFetch, useNavChromeFetcher, useThemePreference };
3671
+ //# sourceMappingURL=chunk-6KX3DWBC.js.map
3672
+ //# sourceMappingURL=chunk-6KX3DWBC.js.map