@growth-operations/ui-shared 1.0.1 → 1.0.3

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@growth-operations/ui-shared",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Shared HubSpot UI-extension modules (Home, Billing) for Growth Operations apps.",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -114,9 +114,20 @@ function usePortalSession({ context, state, appKey }) {
114
114
  // UI Extensions have no open-URL action — only Link, whose href must exist
115
115
  // before render).
116
116
  useStrictModeEffect(
117
- async ({ mounted }) => {
117
+ async ({ mounted, resetOnUnmount }) => {
118
+ // `state` is the /v1/home payload, fetched async by the host page — it's
119
+ // null on the first render(s). Don't mistake "not loaded yet" for
120
+ // "misconfigured": stay in loading until state arrives, then decide.
121
+ // IMPORTANT: useStrictModeEffect latches an internal fetchedRef on any
122
+ // normal completion, so a bare `return` here would block the re-run when
123
+ // state later arrives (→ spinner forever). resetOnUnmount() clears that
124
+ // ref so the deps-change re-run (state?.billing_base_url) actually fires.
125
+ if (!state) {
126
+ resetOnUnmount();
127
+ return;
128
+ }
118
129
  try {
119
- const base = state?.billing_base_url;
130
+ const base = state.billing_base_url;
120
131
  if (!base) throw new Error("Billing service not configured");
121
132
  if (!appKey) throw new Error("Missing appKey for billing portal");
122
133
  const portalId = context?.portal?.id;