nuxt-ui-tools 1.22.1 → 1.22.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/module.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "configKey": "nuxtUiTools",
6
6
  "docs": "https://ui.nuxt.com/docs/getting-started/installation/nuxt",
7
7
  "name": "nuxt-ui-tools",
8
- "version": "1.22.1",
8
+ "version": "1.22.2",
9
9
  "builder": {
10
10
  "@nuxt/module-builder": "1.0.3",
11
11
  "unbuild": "unknown"
@@ -1,4 +1,10 @@
1
- import { keepPreviousData, useInfiniteQuery, useQueries, useQuery } from "@tanstack/vue-query";
1
+ import {
2
+ keepPreviousData,
3
+ useInfiniteQuery,
4
+ useQueries,
5
+ useQuery,
6
+ useQueryClient
7
+ } from "@tanstack/vue-query";
2
8
  import { computed, readonly, ref, shallowRef, watch } from "vue";
3
9
  import { isArray, isFunction, isNumber, isObject, isString } from "../../shared/utils/predicate.js";
4
10
  import { QUERY_DEFAULTS } from "../constants/query-state.js";
@@ -95,22 +101,35 @@ export function useTableData(params) {
95
101
  const searchParams = requestContext;
96
102
  const dataStaleTime = computed(() => QUERY_DEFAULTS.staleTime.data);
97
103
  const isCursorPagination = computed(() => requestPagination.value.mode === "cursor");
104
+ const sourceDefinition = computed(
105
+ () => resolveSourceDefinition({
106
+ context: contextData.value,
107
+ request: requestContext.value,
108
+ sourceRequest: sourceRequest.value,
109
+ source: params.schema.value.source
110
+ })
111
+ );
112
+ const cachedSourceKey = isCursorPagination.value ? createTableCursorQueryKey(
113
+ sourceDefinition.value.queryKey,
114
+ params.state.queryState.paginationRevision.value
115
+ ) : sourceDefinition.value.queryKey;
116
+ if (isQueryDefinitionEnabled(sourceDefinition.value) && useQueryClient().getQueryData(cachedSourceKey) !== void 0) {
117
+ params.startup.start();
118
+ }
98
119
  const query = useQuery(
99
120
  computed(() => {
100
- const definition = resolveSourceDefinition({
101
- context: contextData.value,
102
- request: requestContext.value,
103
- sourceRequest: sourceRequest.value,
104
- source: params.schema.value.source
105
- });
106
121
  if (isCursorPagination.value) {
107
122
  return disabledQueryDefinition("cursor");
108
123
  }
109
- return withEnabled(definition, params.startup.isActive.value && isContextReady.value, {
110
- placeholderData: keepPreviousData,
111
- refetchOnWindowFocus: QUERY_DEFAULTS.refetchOnWindowFocus,
112
- staleTime: dataStaleTime.value
113
- });
124
+ return withEnabled(
125
+ sourceDefinition.value,
126
+ params.startup.isActive.value && isContextReady.value,
127
+ {
128
+ placeholderData: keepPreviousData,
129
+ refetchOnWindowFocus: QUERY_DEFAULTS.refetchOnWindowFocus,
130
+ staleTime: dataStaleTime.value
131
+ }
132
+ );
114
133
  })
115
134
  );
116
135
  const infiniteQuery = useInfiniteQuery(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-ui-tools",
3
- "version": "1.22.1",
3
+ "version": "1.22.2",
4
4
  "description": "Nuxt module and runtime toolkit for UI-heavy Nuxt applications",
5
5
  "homepage": "https://github.com/ChronicStone/nuxt-ui-tools#readme",
6
6
  "bugs": "https://github.com/ChronicStone/nuxt-ui-tools/issues",