Download node_modules/@tanstack/query-core/build/modern/infiniteQueryObserver.js from metarm/QMetaRam: direct link, hf CLI and curl.
- Browser
- Download file 2.05 kB
-
https://huggingface.co/metarm/QMetaRam/resolve/main/node_modules/%40tanstack/query-core/build/modern/infiniteQueryObserver.js
- Command line
-
hf download hf://metarm/QMetaRam/node_modules/@tanstack/query-core/build/modern/infiniteQueryObserver.js
-
curl -L -o infiniteQueryObserver.js https://huggingface.co/metarm/QMetaRam/resolve/main/node_modules/%40tanstack/query-core/build/modern/infiniteQueryObserver.js
2.05 kB
| import { hasNextPage, hasPreviousPage } from "./infiniteQueryBehavior.js"; | |
| import { QueryObserver } from "./queryObserver.js"; | |
| //#region src/infiniteQueryObserver.ts | |
| var InfiniteQueryObserver = class extends QueryObserver { | |
| constructor(client, options) { | |
| super(client, options); | |
| } | |
| bindMethods() { | |
| super.bindMethods(); | |
| this.fetchNextPage = this.fetchNextPage.bind(this); | |
| this.fetchPreviousPage = this.fetchPreviousPage.bind(this); | |
| } | |
| setOptions(options) { | |
| options._type = "infinite"; | |
| super.setOptions(options); | |
| } | |
| getOptimisticResult(options) { | |
| options._type = "infinite"; | |
| return super.getOptimisticResult(options); | |
| } | |
| fetchNextPage(options) { | |
| return this.fetch({ | |
| ...options, | |
| meta: { fetchMore: { direction: "forward" } } | |
| }); | |
| } | |
| fetchPreviousPage(options) { | |
| return this.fetch({ | |
| ...options, | |
| meta: { fetchMore: { direction: "backward" } } | |
| }); | |
| } | |
| createResult(query, options) { | |
| const { state } = query; | |
| const parentResult = super.createResult(query, options); | |
| const { isFetching, isRefetching, isError, isRefetchError } = parentResult; | |
| const fetchDirection = state.fetchMeta?.fetchMore?.direction; | |
| const isFetchNextPageError = isError && fetchDirection === "forward"; | |
| const isFetchingNextPage = isFetching && fetchDirection === "forward"; | |
| const isFetchPreviousPageError = isError && fetchDirection === "backward"; | |
| const isFetchingPreviousPage = isFetching && fetchDirection === "backward"; | |
| return { | |
| ...parentResult, | |
| fetchNextPage: this.fetchNextPage, | |
| fetchPreviousPage: this.fetchPreviousPage, | |
| hasNextPage: hasNextPage(options, state.data), | |
| hasPreviousPage: hasPreviousPage(options, state.data), | |
| isFetchNextPageError, | |
| isFetchingNextPage, | |
| isFetchPreviousPageError, | |
| isFetchingPreviousPage, | |
| isRefetchError: isRefetchError && !isFetchNextPageError && !isFetchPreviousPageError, | |
| isRefetching: isRefetching && !isFetchingNextPage && !isFetchingPreviousPage | |
| }; | |
| } | |
| }; | |
| //#endregion | |
| export { InfiniteQueryObserver }; | |
| //# sourceMappingURL=infiniteQueryObserver.js.map |