@asteby/metacore-runtime-react 39.2.9 → 39.2.10

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @asteby/metacore-runtime-react
2
2
 
3
+ ## 39.2.10
4
+
5
+ ### Patch Changes
6
+
7
+ - aaad307: Un toast guardado en la campana (`POST /notifications/me`) ya no borra las cachés del lote ni de options: no cambia ningún registro que se liste.
8
+
3
9
  ## 39.2.9
4
10
 
5
11
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"api-context.d.ts","sourceRoot":"","sources":["../src/api-context.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAwD,MAAM,OAAO,CAAA;AAI5E,uEAAuE;AACvE,MAAM,WAAW,SAAS;IACtB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,GAAG,CAAC;QAAC,OAAO,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC,CAAA;IACzE,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,GAAG,CAAC;QAAC,OAAO,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC,CAAA;IACtF,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,GAAG,CAAC;QAAC,OAAO,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC,CAAA;IACrF,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,GAAG,CAAC;QAAC,OAAO,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EAAE,MAAM,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,GAAG,CAAC;QAAC,OAAO,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC,CAAA;IACrF,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,GAAG,CAAC;QAAC,OAAO,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC,CAAA;CAC/E;AAID,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,SAAS,CAAA;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC5B;AAED,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,gBAAgB,qBAuBjE;AAmCD,mFAAmF;AACnF,wBAAgB,MAAM,IAAI,SAAS,CAgBlC;AAED;;wEAEwE;AACxE,MAAM,WAAW,WAAW;IACxB,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CACzC;AAID,MAAM,WAAW,mBAAmB;IAChC,MAAM,EAAE,WAAW,CAAA;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC5B;AAED,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,mBAAmB,qBAEvE;AAED,wBAAgB,gBAAgB,IAAI,WAAW,CAE9C"}
@@ -30,13 +30,17 @@ export function ApiProvider({ client, children }) {
30
30
  }, [client]);
31
31
  return _jsx(ApiContext.Provider, { value: client, children: children });
32
32
  }
33
- // The read batch is a POST to /q; it reads, so it must not count as a write.
34
- const BATCH_READ_URL = /(^|\/)q\/?(\?|$)/;
33
+ // POSTs that do not change any record a list or picker shows: the read batch
34
+ // (/q) and the bell inbox the host writes on every control toast
35
+ // (/notifications/me). Counting them as writes dropped the caches on each read
36
+ // or toast.
37
+ const NOT_A_RECORD_WRITE = [/(^|\/)q\/?(\?|$)/, /(^|\/)notifications\/me\/?(\?|$)/];
35
38
  function isWrite(method, url) {
36
39
  const m = (method ?? '').toLowerCase();
37
40
  if (m === '' || m === 'get' || m === 'head' || m === 'options')
38
41
  return false;
39
- return !BATCH_READ_URL.test(url ?? '');
42
+ const u = url ?? '';
43
+ return !NOT_A_RECORD_WRITE.some((re) => re.test(u));
40
44
  }
41
45
  /** Drops the batch rows and the picker options the runtime remembered. */
42
46
  function forgetRemembered() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asteby/metacore-runtime-react",
3
- "version": "39.2.9",
3
+ "version": "39.2.10",
4
4
  "description": "React runtime for metacore hosts — renders addon contributions dynamically",
5
5
  "repository": {
6
6
  "type": "git",
@@ -70,7 +70,7 @@ describe('options cache invalidation', () => {
70
70
  await waitFor(() => expect(screen.getByTestId('opts').textContent).toBe('A,B'))
71
71
  })
72
72
 
73
- it('neither a GET nor the /q read batch drops the cache', async () => {
73
+ it('neither a GET, the /q read batch nor a toast in the bell drops the cache', async () => {
74
74
  const brands = ['A']
75
75
  const { client, hostWrite } = hostClient(brands)
76
76
  const view = render(
@@ -84,6 +84,7 @@ describe('options cache invalidation', () => {
84
84
  await act(async () => {
85
85
  await hostWrite('get')
86
86
  await hostWrite('post', '/q')
87
+ await hostWrite('post', '/notifications/me')
87
88
  })
88
89
  view.unmount()
89
90
  render(
@@ -55,13 +55,17 @@ interface AxiosLike {
55
55
  }
56
56
  }
57
57
 
58
- // The read batch is a POST to /q; it reads, so it must not count as a write.
59
- const BATCH_READ_URL = /(^|\/)q\/?(\?|$)/
58
+ // POSTs that do not change any record a list or picker shows: the read batch
59
+ // (/q) and the bell inbox the host writes on every control toast
60
+ // (/notifications/me). Counting them as writes dropped the caches on each read
61
+ // or toast.
62
+ const NOT_A_RECORD_WRITE = [/(^|\/)q\/?(\?|$)/, /(^|\/)notifications\/me\/?(\?|$)/]
60
63
 
61
64
  function isWrite(method: string | undefined, url: string | undefined): boolean {
62
65
  const m = (method ?? '').toLowerCase()
63
66
  if (m === '' || m === 'get' || m === 'head' || m === 'options') return false
64
- return !BATCH_READ_URL.test(url ?? '')
67
+ const u = url ?? ''
68
+ return !NOT_A_RECORD_WRITE.some((re) => re.test(u))
65
69
  }
66
70
 
67
71
  /** Drops the batch rows and the picker options the runtime remembered. */