@jskit-ai/http-web 0.2.9 → 0.2.11

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": "@jskit-ai/http-web",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "test": "node --test --test-concurrency=1"
@@ -53,8 +53,8 @@
53
53
  "peerDependencies": {
54
54
  "@jskit-ai/http-runtime": "0.2.5",
55
55
  "@jskit-ai/kernel": "0.2.5",
56
- "@jskit-ai/realtime": "0.2.8",
57
- "@jskit-ai/shell-web": "0.2.5",
56
+ "@jskit-ai/realtime": "0.2.9",
57
+ "@jskit-ai/shell-web": "0.2.6",
58
58
  "@tanstack/vue-query": "^5.90.5",
59
59
  "vue": "^3.5.13",
60
60
  "vue-router": "^5.0.4",
@@ -31,7 +31,7 @@ function normalizeQueryKeyValue(queryKey = null) {
31
31
  return [resolved];
32
32
  }
33
33
 
34
- function trimInfinitePagesToFirst(data = null) {
34
+ function trimInfinitePagesToFirst(data) {
35
35
  if (!data || typeof data !== "object" || Array.isArray(data)) {
36
36
  return data;
37
37
  }
@@ -1,5 +1,6 @@
1
1
  import assert from "node:assert/strict";
2
2
  import test from "node:test";
3
+ import { QueryClient } from "@tanstack/vue-query";
3
4
  import { trimInfinitePagesToFirst } from "../src/client/composables/usePagedCollection.js";
4
5
 
5
6
  test("trimInfinitePagesToFirst leaves non-object payloads untouched", () => {
@@ -51,3 +52,15 @@ test("trimInfinitePagesToFirst injects null pageParam when missing", () => {
51
52
  }
52
53
  );
53
54
  });
55
+
56
+ test("trimming a query with no data yet leaves it pending", () => {
57
+ const queryClient = new QueryClient();
58
+ const queryKey = ["records", "filter-not-fetched-yet"];
59
+ queryClient.getQueryCache().build(queryClient, { queryKey });
60
+
61
+ queryClient.setQueryData(queryKey, (data) => trimInfinitePagesToFirst(data));
62
+
63
+ const { data, status } = queryClient.getQueryState(queryKey);
64
+ assert.equal(status, "pending");
65
+ assert.equal(data, undefined);
66
+ });