@growth-operations/ui-shared 1.0.4 → 1.0.5

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.4",
3
+ "version": "1.0.5",
4
4
  "description": "Shared HubSpot UI-extension modules (Home, Billing) for Growth Operations apps.",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -8,7 +8,10 @@
8
8
  // shared with other importers.
9
9
  //
10
10
  // getSettings accepts { force } to bypass the cache (e.g. polling for live sync
11
- // status, which a stale cache would otherwise mask). updateSettings invalidates
11
+ // status, which a stale cache would otherwise mask). `force` bypasses BOTH the
12
+ // frontend module cache AND the backend account cache: it appends ?fresh=1 so a
13
+ // backend that honors it (e.g. toast's CacheableMixin-backed /settings) reads
14
+ // live state instead of its own ~120s-cached copy. updateSettings invalidates
12
15
  // the cache on write.
13
16
  //
14
17
  // All requests go through callAppApi → hubspot.fetch rules apply (object body,
@@ -33,9 +36,14 @@ export function makeSettingsApi({ path = "/api/v1/settings" } = {}) {
33
36
  return settingsPromise;
34
37
  }
35
38
 
39
+ // On a forced read, also ask the backend to bypass its own cache (?fresh=1)
40
+ // so we don't just re-fetch a server-side-stale copy.
41
+ const reqPath = force
42
+ ? `${path}${path.includes("?") ? "&" : "?"}fresh=1`
43
+ : path;
36
44
  const fetchPromise = (async () => {
37
45
  try {
38
- const settings = await callAppApi(context, path, "GET");
46
+ const settings = await callAppApi(context, reqPath, "GET");
39
47
  cachedSettings = settings;
40
48
  settingsPromise = null;
41
49
  return settings;