query icon indicating copy to clipboard operation
query copied to clipboard

[WIP] New useQueryState Hook

Open crutchcorn opened this issue 1 year ago • 5 comments

Closes https://github.com/TanStack/query/discussions/6756

TODO:

  • [ ] Fix any broken tests
  • [x] Migrate useQueryState logic to useMutationState
  • [ ] Add working tests for useQueryState
  • [ ] Mark useIsFetching as deprecated
  • [ ] Mark useIsMutating as deprecated
  • [ ] Update docs to note deprecated fields
  • [ ] Add reference docs

crutchcorn avatar Jan 23 '24 21:01 crutchcorn

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 Feb 3, 2024 11:23am

vercel[bot] avatar Jan 23 '24 21:01 vercel[bot]

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 05e18d36082e094fb400727c429f521681907f5a. 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 1 target

Sent with 💌 from NxCloud.

nx-cloud[bot] avatar Jan 23 '24 21:01 nx-cloud[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 05e18d36082e094fb400727c429f521681907f5a:

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 Jan 23 '24 21:01 codesandbox-ci[bot]

There appear to be two failing tests on this PR and I can't seem to figure out why they're failing. Namely, they are the useFetching API that's been changed.

While debugging, I've noticed the following:

  • notifyManager.schedule(onStoreChange) in useQueryState is called properly with the single item
  • onStoreChange is not ever called

I can't seem to figure out why this is the case or why it works in the other tests, but not these.

It also appears that there's some timing issues with sleep(10) that I've resolved by replacing with new Promise changes.

crutchcorn avatar Jan 23 '24 21:01 crutchcorn

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (c190f68) 41.78% compared to head (05e18d3) 85.09%.

Files Patch % Lines
packages/react-query/src/useQueryState.ts 90.00% 2 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #6758       +/-   ##
===========================================
+ Coverage   41.78%   85.09%   +43.30%     
===========================================
  Files         178       24      -154     
  Lines        7017      322     -6695     
  Branches     1421       83     -1338     
===========================================
- Hits         2932      274     -2658     
+ Misses       3722       39     -3683     
+ Partials      363        9      -354     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Jan 24 '24 09:01 codecov-commenter