Skip to content

Inconsistent select behaviour for non-enumerable / symbol properties. #9726

@ycmjason

Description

@ycmjason

Describe the bug

When select returns an object with non-enumerable / symbol keys, those entries are dropped after queryClient.setQueryData is called,, but not at initial query.

Your minimal, reproducible example

https://stackblitz.com/edit/vitejs-vite-7n6ndech?file=src%2FApp.tsx

Steps to reproduce

  1. Go to stackblitz example
  2. Observe that result.data.hidden is set to result.data.x as expected:
    result.data.x: INITIAL_VALUE
    result.data.y: INITIAL_VALUE
    result.data.hidden: INITIAL_VALUE
    result.data[S(Symbol)]: INITIAL_VALUE
    
  3. Click SET QUERY DATA button
  4. Observe that result.data.hidden is now undefined:
    result.data.x: UPDATED_VALUE
    result.data.y: UPDATED_VALUE
    result.data.hidden: undefined
    result.data[S(Symbol)]: undefined
    

Expected behavior

I expect select will bahave consistently regardless of how the underlying data is set.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • OS: Mac
  • Browser: Chrome

Tanstack Query adapter

react-query

TanStack Query version

^5.90.2

TypeScript version

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions