@vc-shell/framework 2.5.0-pr339.3f40f2e → 2.5.0-pr340.cb4c9dd

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.
@@ -6,25 +6,6 @@ export interface LatestRequest {
6
6
  complete(): void;
7
7
  }
8
8
  export interface UseLatestRequestReturn {
9
- /**
10
- * Runs a request and hands back its result only while it is still the newest.
11
- * A superseded request resolves to `undefined`, so the caller returns early
12
- * instead of writing a stale answer:
13
- *
14
- * ```ts
15
- * const result = await search.latest(client.searchProducts(criteria));
16
- * if (!result) return;
17
- * searchResult.value = result;
18
- * ```
19
- *
20
- * This is `begin`/`isCurrent`/`complete` with the bookkeeping folded in —
21
- * there is no `finally` to forget. Reach for `begin` directly only when the
22
- * request and the check cannot sit in the same function.
23
- *
24
- * Rejections propagate untouched. `undefined` means superseded, so a request
25
- * whose own successful result is `undefined` needs `begin` instead.
26
- */
27
- latest<T>(request: Promise<T>): Promise<T | undefined>;
28
9
  /** Starts a request and supersedes any earlier one. */
29
10
  begin(): LatestRequest;
30
11
  /** Supersedes the in-flight request without starting a new one — e.g. on selection change. */
@@ -42,15 +23,17 @@ export interface UseLatestRequestReturn {
42
23
  * const search = useLatestRequest();
43
24
  *
44
25
  * async function load(criteria) {
45
- * const result = await search.latest(api.search(criteria));
46
- * if (!result) return; // a newer search won
47
- * items.value = result;
26
+ * const request = search.begin();
27
+ * try {
28
+ * const result = await api.search(criteria);
29
+ * if (!request.isCurrent()) return; // a newer search won
30
+ * items.value = result;
31
+ * } finally {
32
+ * request.complete();
33
+ * }
48
34
  * }
49
35
  * ```
50
36
  *
51
- * `begin` is the same thing with the bookkeeping exposed, for the cases where
52
- * the request and the check cannot sit in the same function.
53
- *
54
37
  * This discards the late result rather than cancelling the request: the
55
38
  * generated API clients build their own `RequestInit` and take no `AbortSignal`,
56
39
  * so there is nothing to cancel through. Aborting would additionally save the
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../core/composables/useLatestRequest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkD,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAE/E,MAAM,WAAW,aAAa;IAC5B,2FAA2F;IAC3F,SAAS,IAAI,OAAO,CAAC;IACrB,0FAA0F;IAC1F,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IACvD,uDAAuD;IACvD,KAAK,IAAI,aAAa,CAAC;IACvB,8FAA8F;IAC9F,UAAU,IAAI,IAAI,CAAC;IACnB,2FAA2F;IAC3F,OAAO,IAAI,IAAI,CAAC;IAChB,sDAAsD;IACtD,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,gBAAgB,IAAI,sBAAsB,CAsDzD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../core/composables/useLatestRequest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkD,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAE/E,MAAM,WAAW,aAAa;IAC5B,2FAA2F;IAC3F,SAAS,IAAI,OAAO,CAAC;IACrB,0FAA0F;IAC1F,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC,uDAAuD;IACvD,KAAK,IAAI,aAAa,CAAC;IACvB,8FAA8F;IAC9F,UAAU,IAAI,IAAI,CAAC;IACnB,2FAA2F;IAC3F,OAAO,IAAI,IAAI,CAAC;IAChB,sDAAsD;IACtD,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,gBAAgB,IAAI,sBAAsB,CA2CzD"}
package/dist/framework.js CHANGED
@@ -752,35 +752,25 @@ function Il() {
752
752
  const e = b(!1);
753
753
  let t = 0, a = !1;
754
754
  function n() {
755
- const l = ++t;
756
- let c = !1;
755
+ const r = ++t;
756
+ let l = !1;
757
757
  return a || (e.value = !0), {
758
- isCurrent: () => !a && l === t,
758
+ isCurrent: () => !a && r === t,
759
759
  complete: () => {
760
- c || (c = !0, !a && l === t && (e.value = !1));
760
+ l || (l = !0, !a && r === t && (e.value = !1));
761
761
  }
762
762
  };
763
763
  }
764
- async function s(l) {
765
- const c = n();
766
- try {
767
- const u = await l;
768
- return c.isCurrent() ? u : void 0;
769
- } finally {
770
- c.complete();
771
- }
772
- }
773
- function o() {
764
+ function s() {
774
765
  t++, e.value = !1;
775
766
  }
776
- function r() {
777
- a = !0, o();
767
+ function o() {
768
+ a = !0, s();
778
769
  }
779
- return rt() && it(r), {
780
- latest: s,
770
+ return rt() && it(o), {
781
771
  begin: n,
782
- invalidate: o,
783
- dispose: r,
772
+ invalidate: s,
773
+ dispose: o,
784
774
  pending: Me(e)
785
775
  };
786
776
  }
@@ -2131,12 +2121,12 @@ function xo() {
2131
2121
  hasNotification: (t) => e.hasNotification(t)
2132
2122
  });
2133
2123
  }
2134
- const $o = "2.5.0-pr339.3f40f2e";
2124
+ const $o = "2.5.0-pr340.cb4c9dd";
2135
2125
  function Ko() {
2136
2126
  return {
2137
2127
  version: $o,
2138
- buildDate: "2026-09-01T06:36:03.116Z",
2139
- gitHash: "3f40f2eb0"
2128
+ buildDate: "2026-09-01T06:41:15.384Z",
2129
+ gitHash: "cb4c9ddc4"
2140
2130
  };
2141
2131
  }
2142
2132
  function zo(e = Ko()) {