Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: TanStack/query
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main@{1day}
Choose a base ref
...
head repository: TanStack/query
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 11 commits
  • 112 files changed
  • 9 contributors

Commits on Jun 2, 2025

  1. refactor(types): narrow onSuccess/onError/onMutate/onSettled callback…

    … types to Promise<void> | void (#9202)
    
    * refactor: narrow onSuccess/onError/onMutate/onSettled callback types to Promise<void> | void
    
    Previously, the `onSuccess`, `onError`, `onMutate`, and `onSettled` callbacks were typed as `() => Promise<unknown> | unknown`. While `unknown` is technically valid, it implies that the return value might be used, assigned, or further processed. However, throughout the codebase, these callbacks are invoked solely for their side effects, and their return values are always ignored. Narrowing the type to `Promise<void> | void` makes this intent explicit, clarifies that any return value will be discarded, and prevents misleading type signatures that suggest otherwise.
    
    This commit narrows their types to `() => Promise<void> | void`, which more accurately reflects their intended use.
    
    * docs: update callback return types to Promise<void> | void in mutation-related documentation
    
    This commit refines the documentation for mutation-related callbacks (`onSuccess`, `onError`, `onSettled`, and `onMutate`), changing their return types from `Promise<unknown> | unknown` to `Promise<void> | void`.
    braden-w authored Jun 2, 2025
    Configuration menu
    Copy the full SHA
    982f6ca View commit details
    Browse the repository at this point in the history
  2. docs: Mention query keys needs to be serializable using `JSON.stringi…

    …fy` (#9204)
    
    This was not clear to me and so maybe a useful addition to the docs
    Zentrik authored Jun 2, 2025
    Configuration menu
    Copy the full SHA
    ff2b51a View commit details
    Browse the repository at this point in the history
  3. release: v5.79.1

    tannerlinsley committed Jun 2, 2025
    Configuration menu
    Copy the full SHA
    7c5a8b6 View commit details
    Browse the repository at this point in the history
  4. refactor(query-core): extract context creation to functions and move …

    …type assertions (#9210)
    
    This refactor extracts the creation of the query function context and fetch context into dedicated helper functions (e.g., `createQueryFnContext`), improving code readability. This change:
    
    - Moves type assertions and type handling higher up, reducing inline type noise and making type boundaries clearer.
    - Replaces ad-hoc object construction with a function that does one thing (build query contexts).
    
    No functional behavior is changed; this is a structural and type-safety improvement.
    braden-w authored Jun 2, 2025
    Configuration menu
    Copy the full SHA
    0cbfc5e View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    0e083c6 View commit details
    Browse the repository at this point in the history
  6. release: v5.79.2

    tannerlinsley committed Jun 2, 2025
    Configuration menu
    Copy the full SHA
    214fafd View commit details
    Browse the repository at this point in the history
  7. feat(query-devtools): add indicator for staleTime: "static" (#9215)

    Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
    minseong0324 and TkDodo authored Jun 2, 2025
    Configuration menu
    Copy the full SHA
    3e7d715 View commit details
    Browse the repository at this point in the history
  8. chore: improve type safety in getQueryData by using generics (#9218)

    Refactored the `getQueryData` method in `QueryClient` to use generics for type inference instead of type assertion with `as`.
    
    The previous implementation of `getQueryData` relied on a type assertion (`as`) to cast the result of `queryCache.get()`:
    
    ```typescript
        return this.#queryCache.get(options.queryHash)?.state.data as
          | TInferredQueryFnData
          | undefined
    ```
    
    While this works, using generics is a more type-safe and idiomatic approach in TypeScript. It allows the type system to infer the correct type for `TInferredQueryFnData` when `queryCache.get` is called, reducing the need for manual type casting and potential runtime errors if the cast is incorrect.
    
    ## Changes
    
    The `getQueryData` method has been updated to pass `TInferredQueryFnData` as a generic type argument to `this.#queryCache.get()`:
    
    **Before:**
    
    ```typescript
        return this.#queryCache.get(options.queryHash)?.state.data as
          | TInferredQueryFnData
          | undefined
    ```
    
    **After:**
    
    ```typescript
        return this.#queryCache.get<TInferredQueryFnData>(options.queryHash)?.state
          .data
    ```
    
    This change leverages the existing generic type parameter `TInferredQueryFnData` already defined in the `getQueryData` signature and `QueryCache#get` method.
    braden-w authored Jun 2, 2025
    Configuration menu
    Copy the full SHA
    3a89ec9 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    4bf169e View commit details
    Browse the repository at this point in the history
  10. chore: remove redundant word in comment (#9231)

    Signed-off-by: clonemycode <clonecode@aliyun.com>
    Co-authored-by: Jonghyeon Ko <manudeli.ko@gmail.com>
    clonemycode and manudeli authored Jun 2, 2025
    Configuration menu
    Copy the full SHA
    a2a23a8 View commit details
    Browse the repository at this point in the history
  11. refactor(types): remove unnecessary TQueryData generic in InfiniteQue…

    …ryObserverOptions (#9224)
    
    * refactor(core): remove unnecessary TQueryData in InfiniteQueryObserverOptions
    
    * refactor(react-query,solid-query,svelte-query,vue-query,angular-query): remove unnecessary TQueryData in InfiniteQueryObserverOptions
    
    * ci: apply automated fixes
    
    ---------
    
    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
    Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
    3 people authored Jun 2, 2025
    Configuration menu
    Copy the full SHA
    efa963d View commit details
    Browse the repository at this point in the history
Loading