@growth-operations/ui-shared 1.0.2 → 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 +1 -1
- package/src/billing/BillingTab.jsx +10 -4
package/package.json
CHANGED
|
@@ -114,12 +114,18 @@ 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
118
|
// `state` is the /v1/home payload, fetched async by the host page — it's
|
|
119
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
|
-
//
|
|
122
|
-
|
|
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
|
+
}
|
|
123
129
|
try {
|
|
124
130
|
const base = state.billing_base_url;
|
|
125
131
|
if (!base) throw new Error("Billing service not configured");
|