Skip to content

expose CancelOptions & SetDataOptions - #2855

Merged
TkDodo merged 2 commits into
TanStack:masterfrom
KATT:katt/cancel
Oct 29, 2021
Merged

TkDodo merged 2 commits into
TanStack:masterfrom
KATT:katt/cancel

Conversation

@KATT

@KATT KATT commented Oct 28, 2021 •

Copy link
Copy Markdown
Contributor

Background: it would be nice if I didn't have to do this :)

Technically, this is a breaking change - the other idea I had was to just expose these types in the types.ts-file but then the linter complained about circular dep.

It's hard structuring what is "internal" and what is "external" types - the way I go about it in tRPC is that I have folders called internal/ in various places and I make sure to only cherry-pick from those, and they aren't cherry-picked I do export *

@vercel

vercel Bot commented Oct 28, 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/Hp9ECaWfwkZAMhuPW5jo1PuhoVGD
✅ Preview: https://react-query-git-fork-katt-katt-cancel-tanstack.vercel.app

@codesandbox-ci

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.

@KATT

KATT commented Oct 28, 2021

Copy link
Copy Markdown
Contributor Author

Actually - will do another version

@KATT KATT closed this Oct 28, 2021
@KATT
KATT deleted the katt/cancel branch October 28, 2021 23:29
@KATT
KATT restored the katt/cancel branch October 28, 2021 23:30
@KATT KATT reopened this Oct 28, 2021
@KATT

KATT commented Oct 28, 2021

Copy link
Copy Markdown
Contributor Author

Actually number 2 - my other idea created a dependency cycle

KATT added a commit to KATT/react-query that referenced this pull request Oct 28, 2021
@TkDodo

TkDodo commented Oct 29, 2021

Copy link
Copy Markdown
Collaborator

theoretically, you could infer those types by extracting them from the Parameters of setQueryData.

Technically, this is a breaking change

why would this be a breaking change?

@KATT

KATT commented Oct 29, 2021

Copy link
Copy Markdown
Contributor Author

theoretically, you could infer those types by extracting them from the Parameters of setQueryData.

I did that at first but it doesn't work with invalidateQueries:

invalidateQueries<TPageData = unknown>(filters?: InvalidateQueryFilters<TPageData>, options?: InvalidateOptions): Promise<void>;
invalidateQueries<TPageData = unknown>(queryKey?: QueryKey, filters?: InvalidateQueryFilters<TPageData>, options?: InvalidateOptions): Promise<void>;

Technically, this is a breaking change

why would this be a breaking change?

It's changing publicly exposed types. Will break tRPC for instance since I merged that PR, but I'll just fix it and bump the react-query peer dependency once this one is merged.

@TkDodo

TkDodo commented Oct 29, 2021

Copy link
Copy Markdown
Collaborator

It's changing publicly exposed types.

I think they are only considered publicly exposed when being imported directly from react-query, like:

import { QueryContext } from 'react-query'

if you import it from 'react-query/types/core/query' I don't think that is considered public :)

also, per the docs:

Changes to types in this repository are considered non-breaking and are usually released as patch semver changes (otherwise every type enhancement would be a major version!).

So I'm happy to merge this if you are

@KATT

KATT commented Oct 29, 2021

Copy link
Copy Markdown
Contributor Author

I'm happy!

@TkDodo
TkDodo merged commit f21d932 into TanStack:master Oct 29, 2021
@tannerlinsley

Copy link
Copy Markdown
Member

🎉 This PR is included in version 3.29.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@KATT

KATT commented Oct 29, 2021

Copy link
Copy Markdown
Contributor Author

@all-contributors add @KATT for code? :)

@allcontributors

Copy link
Copy Markdown
Contributor

@KATT

This project's configuration file has malformed JSON: .all-contributorsrc. Error:: Unexpected token ] in JSON at position 3864

@KATT
KATT deleted the katt/cancel branch October 29, 2021 23:40
@TkDodo

TkDodo commented Oct 30, 2021

Copy link
Copy Markdown
Collaborator

@KATT would you like to fix the .all-contributorsrc file, too 😁 ?

@KATT

KATT commented Nov 3, 2021

Copy link
Copy Markdown
Contributor Author

@KATT would you like to fix the .all-contributorsrc file, too 😁 ?

I can't see what's wrong with it!

@TkDodo

TkDodo commented Nov 6, 2021

Copy link
Copy Markdown
Collaborator

@KATT I think it might be the trailing comma which I added here manually 🤦

https://github.com/tannerlinsley/react-query/blob/f348673dce003e82a818cc3cc093dea79b0177ea/.all-contributorsrc#L150

@TkDodo

TkDodo commented Nov 17, 2021

Copy link
Copy Markdown
Collaborator

@all-contributors please add @KATT for code

@allcontributors

Copy link
Copy Markdown
Contributor

@TkDodo

I've put up a pull request to add @KATT! 🎉

This branch was successfully deployed

1 active deployment
Preview — d2e95b58 Deployed Oct 28, 2021 by vercel[bot]
Sign up for free to 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