-
Notifications
You must be signed in to change notification settings - Fork 20
Add datatag to ConnectQueryKey so queryClient can infer type info #532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Paul Sachs <[email protected]>
We have an open question for this change. We can enforce that all ConnectQueryKeys have this type parameter or just make |
Signed-off-by: Paul Sachs <[email protected]>
I went with an in-between option, I require a param on |
Signed-off-by: Paul Sachs <[email protected]>
Signed-off-by: Paul Sachs <[email protected]>
Signed-off-by: Paul Sachs <[email protected]>
Signed-off-by: Paul Sachs <[email protected]>
Signed-off-by: Paul Sachs <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat!
Signed-off-by: Paul Sachs <[email protected]>
Signed-off-by: Paul Sachs <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
## What's Changed * Add datatag to ConnectQueryKey so queryClient can infer type info by @paul-sachs in #532 ## New Contributors * @guspan-tanadi made their first contribution in #537 **Full Changelog**: v2.0.1...v2.1.0 Signed-off-by: Paul Sachs <[email protected]>
By adding DataTag annotations to the ConnectQueryKey, QueryClient methods can now infer the return type when calling things like
getQueryData
orinvalidateQueries
.This is at least a partial alternative to #468 which provides better inference abilities while keeping our api surface smaller. There may still be value down the line with very well defined query client methods but I suspect this change covers 90% of the current use cases.