Skip to content

feat(useQuery): add meta field - #2818

Merged
TkDodo merged 13 commits into
TanStack:masterfrom
zaguiini:feature/meta-field-on-query
Oct 26, 2021
Merged

feat(useQuery): add meta field#2818
TkDodo merged 13 commits into
TanStack:masterfrom
zaguiini:feature/meta-field-on-query

Conversation

@zaguiini

@zaguiinizaguiini commented Oct 21, 2021

Copy link
Copy Markdown
Contributor

Closes #2772.

Usage example (parts of the code omitted for brevity):

persistQueryClient({
queryClient,persistor: localStoragePersistor,dehydrateOptions: {shouldDehydrateQuery: (query: Query)=>{constshouldPersist=query.meta.persist??true;returnshouldPersist;},},});constFetchData=()=>{constqueryKey=["repoData",123];useQuery(queryKey,{meta: {persist: false,},});returnnull;};

@vercel

vercelBot commented Oct 21, 2021

Copy link
Copy Markdown

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/tanstack/react-query/6DGpHYWBTprMYnqWwdxRd7dg7UEY
✅ Preview: https://react-query-git-fork-zaguiini-feature-meta-fiel-ff32b5-tanstack.vercel.app

@codesandbox-ci

codesandbox-ciBot commented Oct 21, 2021

Copy link
Copy Markdown

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.

@zaguiinizaguiini changed the title feat(query): add meta fieldfeat(useQuery): add meta fieldOct 21, 2021

@TkDodoTkDodo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so that you can access it from within the queryFn, and generally everywhere where the context is available. This should also be documented then please

Comment threadsrc/core/query.ts Outdated
@zaguiini

Copy link
Copy Markdown
ContributorAuthor

Thanks for the feedback, @TkDodo! Please take a second look.

@TkDodoTkDodo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good, please have a look at one more finding

Comment threaddocs/src/pages/reference/useQuery.md Outdated
Comment threadsrc/core/types.ts Outdated
@zaguiini

Copy link
Copy Markdown
ContributorAuthor

Thanks for the thorough review, @TkDodo. On to the next -- and hopefully, last -- round of feedback!

@TkDodoTkDodo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks awesome 🚀

@TkDodo
TkDodo merged commit 4472bae into TanStack:masterOct 26, 2021
@tannerlinsley

Copy link
Copy Markdown
Member

🎉 This PR is included in version 3.29.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@zaguiini
zaguiini deleted the feature/meta-field-on-query branch October 26, 2021 20:52
sejas added a commit to Automattic/wp-calypso that referenced this pull request Oct 19, 2022
In these PR's we've introduced the persistance of react query using IndexDB.
- #56828
- #68187
To avoid this persiting a query we need to add a meta property `persist: false` that was introduced on React Query by @zaguiini in TanStack/query#2818
danielbachhuber pushed a commit to Automattic/wp-calypso that referenced this pull request Oct 19, 2022
In these PR's we've introduced the persistance of react query using IndexDB.
- #56828
- #68187
To avoid this persiting a query we need to add a meta property `persist: false` that was introduced on React Query by @zaguiini in TanStack/query#2818
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@zaguiini@tannerlinsley@TkDodo