mulink 1.1.1 → 1.1.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.
@@ -3465,10 +3465,7 @@ ${actions}`;
3465
3465
  parameterProcessing = "";
3466
3466
  requestOptionsParams = "";
3467
3467
  }
3468
- const parsedInputType = hasRequestBody || hasAnyParams ? schemaName.includes("\n") ? `z.infer<typeof z.object({
3469
- body: ${operationName}RequestSchema,
3470
- params: ${operationName}ParamsSchema
3471
- })>` : `z.infer<typeof ${schemaName}>` : "void";
3468
+ const parsedInputType = hasRequestBody || hasAnyParams ? schemaName.includes("\n") ? `z.infer<typeof z.object({ body: ${operationName}RequestSchema, params: ${operationName}ParamsSchema })>` : `z.infer<typeof ${schemaName}>` : "void";
3472
3469
  const ctxType = requiresAuth || hasRateLimit ? "{ user?: any; ratelimit?: { remaining: number } }" : "any";
3473
3470
  const ctxDeclaration = requiresAuth || hasRateLimit ? `ctx: ${ctxType}` : "ctx?: any";
3474
3471
  const actionArgsType = `{ parsedInput: ${parsedInputType}; ${ctxDeclaration} }`;
@@ -3926,6 +3923,7 @@ export function ${hookName.replace("use", "useInfinite")}(${parameterTypes.lengt
3926
3923
 
3927
3924
  return useInfiniteQuery({
3928
3925
  queryKey: [...${queryKey}, 'infinite', searchParams],
3926
+ initialPageParam: 1,
3929
3927
  queryFn: async ({ pageParam = 1, signal }: { pageParam?: number; signal?: AbortSignal }) => {
3930
3928
  try {
3931
3929
  const result = await resolveActionResult<${returnType}>(${actionName}(${actionCallParams.replace(queryParamObject, "{ ...searchParams, page: pageParam, limit: searchParams.limit }")}))
@@ -3935,9 +3933,26 @@ export function ${hookName.replace("use", "useInfinite")}(${parameterTypes.lengt
3935
3933
  }
3936
3934
  },
3937
3935
  getNextPageParam: (lastPage: ${returnType}, allPages: ${returnType}[]) => {
3938
- if (lastPage?.hasMore || (Array.isArray(lastPage) && lastPage.length === searchParams.limit)) {
3936
+ // Check if response has pagination metadata
3937
+ if (lastPage && typeof lastPage === 'object' && 'hasMore' in lastPage && (lastPage as any).hasMore) {
3939
3938
  return allPages.length + 1
3940
3939
  }
3940
+ // Fallback: check if array length matches limit (suggesting more pages)
3941
+ if (Array.isArray(lastPage) && lastPage.length === searchParams.limit) {
3942
+ return allPages.length + 1
3943
+ }
3944
+ // Check if response has total and we haven't loaded all items
3945
+ if (lastPage && typeof lastPage === 'object' && 'total' in lastPage && Array.isArray((lastPage as any).files || (lastPage as any).items || lastPage)) {
3946
+ const items = (lastPage as any).files || (lastPage as any).items || lastPage
3947
+ const total = (lastPage as any).total || 0
3948
+ const loaded = allPages.reduce((sum, page) => {
3949
+ const pageItems = (page as any)?.files || (page as any)?.items || (Array.isArray(page) ? page : [])
3950
+ return sum + (Array.isArray(pageItems) ? pageItems.length : 0)
3951
+ }, 0)
3952
+ if (loaded < total) {
3953
+ return allPages.length + 1
3954
+ }
3955
+ }
3941
3956
  return undefined
3942
3957
  },
3943
3958
  staleTime: ${staleTime},
@@ -3946,9 +3961,7 @@ export function ${hookName.replace("use", "useInfinite")}(${parameterTypes.lengt
3946
3961
  refetchOnWindowFocus: true,
3947
3962
  refetchOnReconnect: true,
3948
3963
  refetchOnMount: 'always',
3949
- placeholderData: (previousData: ${returnType} | undefined) => previousData,
3950
3964
  retry: 3,
3951
- initialData: initialData as ${returnType} | undefined,
3952
3965
  ...restOptions
3953
3966
  })
3954
3967
  }
@@ -4391,13 +4404,13 @@ export function useBridgeInfiniteQuery<TData = unknown, TError = Error>(
4391
4404
  ) {
4392
4405
  return useInfiniteQuery<TData, TError>({
4393
4406
  queryKey,
4407
+ initialPageParam: 1,
4394
4408
  queryFn: queryFn as QueryFunction<TData, QueryKey>,
4395
4409
  staleTime: 5 * 60 * 1000,
4396
4410
  gcTime: 10 * 60 * 1000,
4397
4411
  refetchOnWindowFocus: true,
4398
4412
  refetchOnReconnect: true,
4399
4413
  refetchOnMount: 'always',
4400
- placeholderData: (previousData: TData | undefined) => previousData,
4401
4414
  retry: (failureCount: number, error: Error) => {
4402
4415
  if (error instanceof Error && error.message.includes('4')) return false
4403
4416
  return failureCount < 3
@@ -9738,5 +9751,5 @@ exports.VersionChecker = VersionChecker;
9738
9751
  exports.__name = __name;
9739
9752
  exports.checkAndNotifyUpdates = checkAndNotifyUpdates;
9740
9753
  exports.createBridgeVersionChecker = createBridgeVersionChecker;
9741
- //# sourceMappingURL=chunk-KATSH6VN.cjs.map
9742
- //# sourceMappingURL=chunk-KATSH6VN.cjs.map
9754
+ //# sourceMappingURL=chunk-LTXRMKAN.cjs.map
9755
+ //# sourceMappingURL=chunk-LTXRMKAN.cjs.map