query icon indicating copy to clipboard operation
query copied to clipboard

test(queryCache): add failing test for partially undefined key (#3741)

Open maxandron opened this issue 3 years ago • 1 comments

The current behavior when using functions such as invalidateQueries or setQueriesData is unexpected when objects with undefined properties are involved.

A key containing an object with an undefined property is hashed without the undefined property, yet the property is considered in the partialDeepEqual function.

This creates some confusing scenarios, as demonstrated in the discussion on TkDodo's blog https://github.com/TkDodo/blog-comments/discussions/71#discussioncomment-4348406 and in the referenced issue

This commit includes a failing test to demonstrate the expected behavior

maxandron avatar Dec 09 '22 17:12 maxandron

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 719c518fdf64f3b575e15ba94cc79dd70ec22448:

Sandbox Source
@tanstack/query-example-react-basic-typescript Configuration
@tanstack/query-example-solid-basic-typescript Configuration
@tanstack/query-example-vue-basic Configuration

codesandbox-ci[bot] avatar Dec 09 '22 17:12 codesandbox-ci[bot]