Skip to content

[draft] expose query options and skiptoken on generated useQuery hooks#3528

Draft
nmokkenstorm wants to merge 1 commit intohey-api:mainfrom
nmokkenstorm:feat/use-query-options
Draft

[draft] expose query options and skiptoken on generated useQuery hooks#3528
nmokkenstorm wants to merge 1 commit intohey-api:mainfrom
nmokkenstorm:feat/use-query-options

Conversation

@nmokkenstorm
Copy link
Contributor

@nmokkenstorm nmokkenstorm commented Mar 9, 2026

Builds on #3432 (useMutation hooks) to add skipToken support and queryOptions override for the TanStack React Query plugin.

Closes #2766

@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@vercel
Copy link

vercel bot commented Mar 9, 2026

@nmokkenstorm is attempting to deploy a commit to the Hey API Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot
Copy link

changeset-bot bot commented Mar 9, 2026

🦋 Changeset detected

Latest commit: d6ebc7c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@hey-api/openapi-ts Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@nmokkenstorm nmokkenstorm force-pushed the feat/use-query-options branch from 6d07fd5 to cf8e859 Compare March 9, 2026 15:55
@codecov
Copy link

codecov bot commented Mar 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 39.03%. Comparing base (b2de023) to head (d6ebc7c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3528      +/-   ##
==========================================
- Coverage   39.08%   39.03%   -0.05%     
==========================================
  Files         495      495              
  Lines       18451    18495      +44     
  Branches     5479     5479              
==========================================
+ Hits         7212     7220       +8     
- Misses       9071     9103      +32     
- Partials     2168     2172       +4     
Flag Coverage Δ
unittests 39.03% <ø> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 9, 2026

Open in StackBlitz

@hey-api/codegen-core

npm i https://pkg.pr.new/@hey-api/codegen-core@3528

@hey-api/json-schema-ref-parser

npm i https://pkg.pr.new/@hey-api/json-schema-ref-parser@3528

@hey-api/nuxt

npm i https://pkg.pr.new/@hey-api/nuxt@3528

@hey-api/openapi-ts

npm i https://pkg.pr.new/@hey-api/openapi-ts@3528

@hey-api/shared

npm i https://pkg.pr.new/@hey-api/shared@3528

@hey-api/types

npm i https://pkg.pr.new/@hey-api/types@3528

@hey-api/vite-plugin

npm i https://pkg.pr.new/@hey-api/vite-plugin@3528

commit: 4ea3c27

@mrlubos
Copy link
Member

mrlubos commented Mar 9, 2026

@nmokkenstorm Why is it an optional configuration flag? Why not add it for everyone?

@mrlubos
Copy link
Member

mrlubos commented Mar 9, 2026

@nandorojo will like this

@mrlubos
Copy link
Member

mrlubos commented Mar 9, 2026

@nmokkenstorm I updated your description with linked issue

@nmokkenstorm
Copy link
Contributor Author

@nmokkenstorm Why is it an optional configuration flag? Why not add it for everyone?

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.

@mrlubos
Copy link
Member

mrlubos commented Mar 9, 2026

@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

@nmokkenstorm
Copy link
Contributor Author

@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!

@nmokkenstorm nmokkenstorm force-pushed the feat/use-query-options branch from 7df42fb to 3007b3c Compare March 10, 2026 08:27
@mrlubos
Copy link
Member

mrlubos commented Mar 10, 2026

@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

@nmokkenstorm
Copy link
Contributor Author

@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!

@nmokkenstorm nmokkenstorm changed the title [draft] add useQuery hooks and skipToken support [draft] expose query options and skiptoken on generated useQuery hooks Mar 10, 2026
@mrlubos
Copy link
Member

mrlubos commented Mar 10, 2026

Just making sure we're aligned on the scope! I shall retreat once more

@nmokkenstorm nmokkenstorm force-pushed the feat/use-query-options branch from 3007b3c to b40d1b5 Compare March 17, 2026 09:32
@nmokkenstorm nmokkenstorm force-pushed the feat/use-query-options branch from b40d1b5 to d6ebc7c Compare March 17, 2026 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

skip-token support

2 participants