feat: add skipToken support and queryOptions override to TanStack Query useQuery hooks#3528
feat: add skipToken support and queryOptions override to TanStack Query useQuery hooks#3528nmokkenstorm wants to merge 2 commits intohey-api:mainfrom
Conversation
|
|
|
@nmokkenstorm is attempting to deploy a commit to the Hey API Team on Vercel. A member of the Team first needs to authorize it. |
|
6d07fd5 to
cf8e859
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3528 +/- ##
==========================================
- Coverage 39.39% 39.35% -0.05%
==========================================
Files 520 521 +1
Lines 19279 19317 +38
Branches 5708 5716 +8
==========================================
+ Hits 7595 7602 +7
- Misses 9445 9472 +27
- Partials 2239 2243 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@hey-api/codegen-core
@hey-api/json-schema-ref-parser
@hey-api/nuxt
@hey-api/openapi-ts
@hey-api/shared
@hey-api/types
@hey-api/vite-plugin
commit: |
|
@nmokkenstorm Why is it an optional configuration flag? Why not add it for everyone? |
|
@nandorojo will like this |
|
@nmokkenstorm I updated your description with linked issue |
habit to make it opt-in tbh. I think the skipToken is a breaking change too on type level and it also slightly increases the generated bundle size but I will check. |
|
@nmokkenstorm I didn't look at the code yet, stopped after seeing the configuration haha. If it's going to be breaking either way, I'd much rather deprecate the old approach because we wouldn't want new users to start with the flag disabled, realize one day they need to enable it, and face a lot of breaking changes. We can talk through it when you feel the pull request is more ready. I'm pretty sure there was another thread where we talked about skip tokens but can't find it, I'd like to ideally avoid another breaking change when that thread gets addressed |
I'll double check, I think it's definately doable to have it be backwards compatible without a breaking change. The useQuery/Mutation stuff was opt in so I stuck to the pattern but I think this can be done without losing ergonomics. I'll update the pr description and ping you if it's reviewable, I needed a remote public ref to do some internal testing with first anyways. Thanks for the feedback! |
7df42fb to
3007b3c
Compare
|
@nmokkenstorm Can you clarify what do you mean by "add useQuery hooks" in the title? React/Preact Query already support generating useQuery hooks so I'm confused what it's referencing |
its about having the generated useQuery hooks exist per entity, with queryoptions and skiptoken enabled. the reason it's named like that is because the original code/branch orginates from a fork that pre-dates the support we had in our project. still tinkering on this, nothing to see/review here yet! |
|
Just making sure we're aligned on the scope! I shall retreat once more |
d6ebc7c to
b1fc4b9
Compare
b1fc4b9 to
2ffe100
Compare
9a24dd1 to
18687d7
Compare
18687d7 to
d8bbba0
Compare
d8bbba0 to
5eb6a92
Compare
Summary
Adds
skipTokensupport andqueryOptionsoverride to generateduseQueryhooks for TanStack Query plugins (React, Preact).useQueryhooks are now generated by default (no config flag needed)skipTokenis always supported — pass it instead of options to conditionally disable a queryqueryOptionsoverride parameter allows customizing the underlying query optionsuseQuery: falseto opt out of generatinguseQueryhooksCloses #2766
Breaking changes
None. This is additive and backwards-compatible:
queryOptionsandqueryKeyscontinue to work as beforeuseQueryhooks are new generated output (enabled by default, opt-out withuseQuery: false)skipTokensupport is wired intoqueryOptionsautomatically