@bjj/nuxt-layer-shadcn-ui 0.11.9 → 0.11.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.
@@ -4,7 +4,6 @@ import { useEventListener } from '@vueuse/core'
4
4
 
5
5
  const props = withDefaults(defineProps<InfiniteDataTableProps<TData>>(), {
6
6
  columns: () => [],
7
- fetchMethod: undefined,
8
7
  autoFetch: true,
9
8
  filters: undefined,
10
9
  pageSize: 30,
@@ -35,6 +34,9 @@ const hasMore = ref(true)
35
34
  const errored = ref(false)
36
35
  const total = ref<number | undefined>(undefined)
37
36
  const requestVersion = ref(0)
37
+ // Tracks whether a fetch has ever been initiated. Gates the IntersectionChecker
38
+ // so `autoFetch=false` doesn't get bypassed by the observer firing on mount.
39
+ const started = ref(false)
38
40
 
39
41
  const sortState = ref<{ sortBy: string | null, sortOrder: number | null }>({
40
42
  sortBy: props.filters?.sortBy ? String(props.filters.sortBy) : null,
@@ -100,9 +102,9 @@ function resetState () {
100
102
  // -- Loading --
101
103
 
102
104
  async function loadMore () {
103
- if (!props.fetchMethod) return
104
105
  if (loading.value || !hasMore.value) return
105
106
 
107
+ started.value = true
106
108
  // Calling loadMore is the retry path; the IntersectionChecker is hidden
107
109
  // while errored, so it can't trigger this branch on its own.
108
110
  errored.value = false
@@ -240,7 +242,7 @@ onMounted(() => {
240
242
  </Button>
241
243
  </div>
242
244
  <EffectIntersectionChecker
243
- v-else-if="!isInitialLoad"
245
+ v-else-if="started"
244
246
  :disabled="loading"
245
247
  :options="intersectionOptions"
246
248
  class="flex items-center justify-center"
@@ -18,10 +18,10 @@ export interface InfiniteDataTableFetchResult<T = Record<string, any>> {
18
18
  }
19
19
 
20
20
  export interface InfiniteDataTableProps<T = Record<string, any>> {
21
+ /** Async function to fetch a page of rows */
22
+ fetchMethod: (params: InfiniteDataTableFetchParams) => Promise<InfiniteDataTableFetchResult<T>>
21
23
  /** Column definitions */
22
24
  columns?: DataTableColumn[]
23
- /** Async function to fetch a page of rows */
24
- fetchMethod?: (params: InfiniteDataTableFetchParams) => Promise<InfiniteDataTableFetchResult<T>>
25
25
  /** Whether to fetch the first page on mount (default: true) */
26
26
  autoFetch?: boolean
27
27
  /** External filter state — changing this resets and reloads */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bjj/nuxt-layer-shadcn-ui",
3
- "version": "0.11.9",
3
+ "version": "0.11.11",
4
4
  "description": "Nuxt layer providing shadcn-vue based UI components",
5
5
  "type": "module",
6
6
  "main": "./nuxt.config.ts",
@@ -42,5 +42,5 @@
42
42
  "vue-i18n": "^11",
43
43
  "vue-router": "^4 || ^5"
44
44
  },
45
- "gitHead": "224de24822a34f421746189a23c7513fe662537f"
45
+ "gitHead": "638440ff1ba8ba346190b8241f0a83a8d6a9da69"
46
46
  }