@spoosh/core 0.18.1 → 0.18.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/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +14 -0
- package/dist/index.mjs +14 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2460,6 +2460,7 @@ type InfiniteReadController<TData, TItem, TError, TMeta = Record<string, unknown
|
|
|
2460
2460
|
fetchNext: () => Promise<void>;
|
|
2461
2461
|
fetchPrev: () => Promise<void>;
|
|
2462
2462
|
trigger: (options?: InfiniteTriggerOptions) => Promise<void>;
|
|
2463
|
+
refetch: () => Promise<void>;
|
|
2463
2464
|
abort: () => void;
|
|
2464
2465
|
mount: () => void;
|
|
2465
2466
|
unmount: () => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -2460,6 +2460,7 @@ type InfiniteReadController<TData, TItem, TError, TMeta = Record<string, unknown
|
|
|
2460
2460
|
fetchNext: () => Promise<void>;
|
|
2461
2461
|
fetchPrev: () => Promise<void>;
|
|
2462
2462
|
trigger: (options?: InfiniteTriggerOptions) => Promise<void>;
|
|
2463
|
+
refetch: () => Promise<void>;
|
|
2463
2464
|
abort: () => void;
|
|
2464
2465
|
mount: () => void;
|
|
2465
2466
|
unmount: () => void;
|
package/dist/index.js
CHANGED
|
@@ -1920,6 +1920,20 @@ function createInfiniteReadController(options) {
|
|
|
1920
1920
|
}
|
|
1921
1921
|
notify();
|
|
1922
1922
|
},
|
|
1923
|
+
async refetch() {
|
|
1924
|
+
const firstPageKey = pageKeys[0];
|
|
1925
|
+
if (!firstPageKey) {
|
|
1926
|
+
await doFetch("next", {});
|
|
1927
|
+
return;
|
|
1928
|
+
}
|
|
1929
|
+
const firstPageRequest = pageRequests.get(firstPageKey) ?? initialRequest;
|
|
1930
|
+
pageSubscriptions.slice(1).forEach((unsub) => unsub());
|
|
1931
|
+
pageSubscriptions = pageSubscriptions.slice(0, 1);
|
|
1932
|
+
pageKeys = [firstPageKey];
|
|
1933
|
+
pageRequests = /* @__PURE__ */ new Map([[firstPageKey, firstPageRequest]]);
|
|
1934
|
+
stateManager.setCache(firstPageKey, { stale: true });
|
|
1935
|
+
await doFetch("next", firstPageRequest);
|
|
1936
|
+
},
|
|
1923
1937
|
abort() {
|
|
1924
1938
|
abortController?.abort();
|
|
1925
1939
|
abortController = null;
|
package/dist/index.mjs
CHANGED
|
@@ -1843,6 +1843,20 @@ function createInfiniteReadController(options) {
|
|
|
1843
1843
|
}
|
|
1844
1844
|
notify();
|
|
1845
1845
|
},
|
|
1846
|
+
async refetch() {
|
|
1847
|
+
const firstPageKey = pageKeys[0];
|
|
1848
|
+
if (!firstPageKey) {
|
|
1849
|
+
await doFetch("next", {});
|
|
1850
|
+
return;
|
|
1851
|
+
}
|
|
1852
|
+
const firstPageRequest = pageRequests.get(firstPageKey) ?? initialRequest;
|
|
1853
|
+
pageSubscriptions.slice(1).forEach((unsub) => unsub());
|
|
1854
|
+
pageSubscriptions = pageSubscriptions.slice(0, 1);
|
|
1855
|
+
pageKeys = [firstPageKey];
|
|
1856
|
+
pageRequests = /* @__PURE__ */ new Map([[firstPageKey, firstPageRequest]]);
|
|
1857
|
+
stateManager.setCache(firstPageKey, { stale: true });
|
|
1858
|
+
await doFetch("next", firstPageRequest);
|
|
1859
|
+
},
|
|
1846
1860
|
abort() {
|
|
1847
1861
|
abortController?.abort();
|
|
1848
1862
|
abortController = null;
|