query icon indicating copy to clipboard operation
query copied to clipboard

fix(query-core): allow function value of `notifyOnChangeProps` query option to return `undefined`

Open winghouchan opened this issue 1 year ago • 5 comments
trafficstars

undefined is a valid return value for the function value of notifyOnChangeProps. See linked issue for more details.

Fixes #7426.

winghouchan avatar May 16 '24 08:05 winghouchan

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
query ⬜️ Ignored (Inspect) Visit Preview Jun 8, 2024 5:42pm

vercel[bot] avatar May 16 '24 08:05 vercel[bot]

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 e28ea029a2f2a77744962a2d5132009a5496eea1:

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

codesandbox-ci[bot] avatar May 16 '24 09:05 codesandbox-ci[bot]

can you amend the signature in the docs as well please?

TkDodo avatar May 16 '24 09:05 TkDodo

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 76abb166ed1ae006eeb9f368da747bb12e74129c. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 2 targets

Sent with 💌 from NxCloud.

nx-cloud[bot] avatar May 16 '24 09:05 nx-cloud[bot]

also the jsdoc please:

https://github.com/TanStack/query/blob/3a8c2b10a1c2a3657d22b0304aab640683a4db0f/packages/query-core/src/types.ts#L319-L326

TkDodo avatar May 16 '24 09:05 TkDodo

@winghouchan will you get this PR over the finish line or should I do it?

TkDodo avatar Jul 17 '24 14:07 TkDodo

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

commit: 76abb16

@tanstack/angular-query-devtools-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-devtools-experimental@7441
@tanstack/angular-query-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-experimental@7441
@tanstack/eslint-plugin-query

npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@7441
@tanstack/query-async-storage-persister

npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@7441
@tanstack/query-broadcast-client-experimental

npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@7441
@tanstack/query-core

npm i https://pkg.pr.new/@tanstack/query-core@7441
@tanstack/query-devtools

npm i https://pkg.pr.new/@tanstack/query-devtools@7441
@tanstack/query-persist-client-core

npm i https://pkg.pr.new/@tanstack/query-persist-client-core@7441
@tanstack/query-sync-storage-persister

npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@7441
@tanstack/react-query

npm i https://pkg.pr.new/@tanstack/react-query@7441
@tanstack/react-query-devtools

npm i https://pkg.pr.new/@tanstack/react-query-devtools@7441
@tanstack/react-query-next-experimental

npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@7441
@tanstack/react-query-persist-client

npm i https://pkg.pr.new/@tanstack/react-query-persist-client@7441
@tanstack/solid-query

npm i https://pkg.pr.new/@tanstack/solid-query@7441
@tanstack/solid-query-devtools

npm i https://pkg.pr.new/@tanstack/solid-query-devtools@7441
@tanstack/solid-query-persist-client

npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@7441
@tanstack/svelte-query

npm i https://pkg.pr.new/@tanstack/svelte-query@7441
@tanstack/svelte-query-devtools

npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@7441
@tanstack/svelte-query-persist-client

npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@7441
@tanstack/vue-query

npm i https://pkg.pr.new/@tanstack/vue-query@7441
@tanstack/vue-query-devtools

npm i https://pkg.pr.new/@tanstack/vue-query-devtools@7441

templates

pkg-pr-new[bot] avatar Jul 17 '24 14:07 pkg-pr-new[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 63.33%. Comparing base (a87c2fe) to head (22c3569). Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           main    #7441       +/-   ##
=========================================
+ Coverage      0   63.33%   +63.33%     
=========================================
  Files         0      125      +125     
  Lines         0     4522     +4522     
  Branches      0     1259     +1259     
=========================================
+ Hits          0     2864     +2864     
- Misses        0     1430     +1430     
- Partials      0      228      +228     
Components Coverage Δ
@tanstack/angular-query-devtools-experimental ∅ <ø> (∅)
@tanstack/angular-query-experimental 86.58% <ø> (∅)
@tanstack/eslint-plugin-query ∅ <ø> (∅)
@tanstack/query-async-storage-persister 43.85% <ø> (∅)
@tanstack/query-broadcast-client-experimental ∅ <ø> (∅)
@tanstack/query-codemods ∅ <ø> (∅)
@tanstack/query-core 92.87% <ø> (∅)
@tanstack/query-devtools 5.24% <ø> (∅)
@tanstack/query-persist-client-core 57.73% <ø> (∅)
@tanstack/query-sync-storage-persister 82.50% <ø> (∅)
@tanstack/react-query 92.98% <ø> (∅)
@tanstack/react-query-devtools 10.71% <ø> (∅)
@tanstack/react-query-next-experimental ∅ <ø> (∅)
@tanstack/react-query-persist-client 100.00% <ø> (∅)
@tanstack/solid-query 78.06% <ø> (∅)
@tanstack/solid-query-devtools ∅ <ø> (∅)
@tanstack/solid-query-persist-client 100.00% <ø> (∅)
@tanstack/svelte-query 90.00% <ø> (∅)
@tanstack/svelte-query-devtools ∅ <ø> (∅)
@tanstack/svelte-query-persist-client 100.00% <ø> (∅)
@tanstack/vue-query 71.42% <ø> (∅)
@tanstack/vue-query-devtools ∅ <ø> (∅)

codecov[bot] avatar Jul 17 '24 14:07 codecov[bot]

@TkDodo: sorry, missed your messages.

I've updated the signature in documentation in 43f0722. As far as I can tell it only affects React (and Vue, although they share the same docs). Please let me know if this is incorrect.

How would you like the JSDoc updated? The current description isn't wrong, although I suppose it could be improved. Maybe something like below:

  • If set to a function, the function will be executed to compute the list of properties.
  • If the value is set or computed to undefined, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. This is the default behaviour.
  • If the value is set or computed to an array, the component will only re-render if any of the listed properties change. For example, if the value is set to or computed to ['data', 'error'], the component will only re-render when the data or error properties change.
  • If the value is set or computed to "all", the component will opt-out of smart tracking and re-render whenever a query is updated.

winghouchan avatar Jul 17 '24 18:07 winghouchan