@growth-operations/ui-shared 1.0.1 → 1.0.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/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.2",
4
4
  "description": "Shared HubSpot UI-extension modules (Home, Billing) for Growth Operations apps.",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -115,8 +115,13 @@ function usePortalSession({ context, state, appKey }) {
115
115
  // before render).
116
116
  useStrictModeEffect(
117
117
  async ({ mounted }) => {
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. The
121
+ // effect re-runs when state?.billing_base_url changes (see deps).
122
+ if (!state) return;
118
123
  try {
119
- const base = state?.billing_base_url;
124
+ const base = state.billing_base_url;
120
125
  if (!base) throw new Error("Billing service not configured");
121
126
  if (!appKey) throw new Error("Missing appKey for billing portal");
122
127
  const portalId = context?.portal?.id;