@raf-query/core 0.13.1 → 0.13.2

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,10 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.13.2](https://github.com/KATT/raf-query/compare/0.13.1...0.13.2) (2026-11-10)
4
+
5
+ ### Bug Fixes
6
+
7
+ * **core:** a prefetch never drops pages keepPages turns down ([#249](https://github.com/KATT/raf-query/issues/249)) ([3c66020](https://github.com/KATT/raf-query/commit/3c66020ee7562c6e2592017a1b11af94bc89e340))
8
+
3
9
  ## [0.13.1](https://github.com/KATT/raf-query/compare/0.13.0...0.13.1) (2026-11-10)
4
10
 
5
11
  ### Features
6
12
 
7
- * **core:** keepPages, for lists whose start stays out of the key ([#248](https://github.com/KATT/raf-query/issues/248)) ([164c88c](https://github.com/KATT/raf-query/commit/164c88c4509a34c9ec51f089c3b70c03ea13cac0))
13
+ - **core:** keepPages, for lists whose start stays out of the key ([#248](https://github.com/KATT/raf-query/issues/248)) ([164c88c](https://github.com/KATT/raf-query/commit/164c88c4509a34c9ec51f089c3b70c03ea13cac0))
8
14
 
9
15
  ## [0.13.0](https://github.com/KATT/raf-query/compare/0.12.0...0.13.0) (2026-11-10)
10
16
 
package/dist/load.mjs CHANGED
@@ -81,13 +81,10 @@ function startIfStale(entry) {
81
81
  function isFresh(entry) {
82
82
  return entry.client.isServer ? entry.state.hasData && !isInvalidated(entry) : !isStale(entry);
83
83
  }
84
- /**
85
- * Drop pages the entry's `keepPages` turns down for the input it was just
86
- * loaded with, so they load again from that input's `initialPageParam`.
87
- */
88
- function dropUnkeptPages(entry) {
84
+ /** Whether the entry's `keepPages` takes its cached pages for the input it was just loaded with. */
85
+ function keepsPages(entry) {
89
86
  const keep = entry.options?.["~keep"];
90
- if (keep && entry.state.hasData && !keep(entry.state.data)) reset(entry);
87
+ return !keep || !entry.state.hasData || keep(entry.state.data);
91
88
  }
92
89
  function waitFresh(entry, pages) {
93
90
  if (isFresh(entry)) return Promise.resolve({ ok: true });
@@ -123,14 +120,18 @@ async function load(client, entries) {
123
120
  }]).map((loaded) => {
124
121
  const item = loaded.item;
125
122
  const cached = entryOf(client, item.factory, item.input);
126
- dropUnkeptPages(cached);
123
+ const kept = keepsPages(cached);
127
124
  let wait;
128
- if (item.kind === "prefetch") startIfStale(cached);
129
- else if (isBrowserOnly(cached) && !cached.state.hasData) wait = Promise.resolve({
125
+ if (item.kind === "prefetch") {
126
+ if (kept) startIfStale(cached);
127
+ } else if (isBrowserOnly(cached) && !cached.state.hasData) wait = Promise.resolve({
130
128
  error: /* @__PURE__ */ new Error(`raf-query: ${cached.hash} has \`ssr: false\`, so the server can't wait for it. Load it with prefetch() instead of ${item.kind}().`),
131
129
  ok: false
132
130
  });
133
- else wait = (item.kind === "revalidate" ? waitFresh : waitAny)(cached, item.pages);
131
+ else {
132
+ if (!kept) reset(cached);
133
+ wait = (item.kind === "revalidate" ? waitFresh : waitAny)(cached, item.pages);
134
+ }
134
135
  return {
135
136
  entry: cached,
136
137
  item,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raf-query/core",
3
- "version": "0.13.1",
3
+ "version": "0.13.2",
4
4
  "description": "Framework-agnostic core of raf-query, a render-as-you-fetch query library",
5
5
  "keywords": [
6
6
  "query",