这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@ahmedrowaihi
Copy link
Contributor

this is another enabler :')
there is a lot of potential use cases, it allows patterns like fetch active queries based on some metas, or invalidation

@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 Aug 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hey-api-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 6, 2025 2:38pm

@changeset-bot
Copy link

changeset-bot bot commented Aug 6, 2025

🦋 Changeset detected

Latest commit: f89e478

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 Patch

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

@codecov
Copy link

codecov bot commented Aug 6, 2025

Codecov Report

❌ Patch coverage is 3.78788% with 127 lines in your changes missing coverage. Please review.
✅ Project coverage is 22.43%. Comparing base (a650513) to head (f89e478).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
...ugins/@tanstack/query-core/infiniteQueryOptions.ts 2.38% 41 Missing ⚠️
...s/src/plugins/@tanstack/query-core/queryOptions.ts 2.63% 37 Missing ⚠️
...rc/plugins/@tanstack/query-core/mutationOptions.ts 4.16% 23 Missing ⚠️
...penapi-ts/src/plugins/@tanstack/query-core/meta.ts 15.38% 11 Missing ⚠️
...ins/@tanstack/angular-query-experimental/config.ts 0.00% 3 Missing ⚠️
...api-ts/src/plugins/@tanstack/react-query/config.ts 0.00% 3 Missing ⚠️
...api-ts/src/plugins/@tanstack/solid-query/config.ts 0.00% 3 Missing ⚠️
...pi-ts/src/plugins/@tanstack/svelte-query/config.ts 0.00% 3 Missing ⚠️
...enapi-ts/src/plugins/@tanstack/vue-query/config.ts 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2399      +/-   ##
==========================================
- Coverage   22.46%   22.43%   -0.03%     
==========================================
  Files         324      325       +1     
  Lines       31971    32027      +56     
  Branches     1234     1234              
==========================================
+ Hits         7181     7186       +5     
- Misses      24781    24832      +51     
  Partials        9        9              
Flag Coverage Δ
unittests 22.43% <3.78%> (-0.03%) ⬇️

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 Aug 6, 2025

Open in StackBlitz

npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/nuxt@2399
npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/openapi-ts@2399
npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/vite-plugin@2399

commit: f89e478

@vercel
Copy link

vercel bot commented Aug 6, 2025

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

A member of the Team first needs to authorize it.

@mrlubos
Copy link
Member

mrlubos commented Aug 6, 2025

@ahmedrowaihi are you willing to improve this feature further? I have some ideas. Aside, can you pick a smaller spec for snapshots? We don't need the big one to demonstrate this feature. We'd get a much nicer diff, there's too much irrelevant stuff included now. I think a few endpoints would suffice to showcase this feature, what do you think?

@ahmedrowaihi
Copy link
Contributor Author

@ahmedrowaihi are you willing to improve this feature further? I have some ideas.

I am all ears ! tell me

Aside, can you pick a smaller spec for snapshots? We don't need the big one to demonstrate this feature. We'd get a much nicer diff, there's too much irrelevant stuff included now. I think a few endpoints would suffice to showcase this feature, what do you think?

true, will use smaller one

@mrlubos
Copy link
Member

mrlubos commented Aug 6, 2025

I would suggest making this an optional function that's completely customizable as long as it returns a valid meta result. I believe those have to be objects?

The concern I have with having a boolean or an array of fields is that it deeply relies on the current operation model which might change. I'd almost say making it an object with toggleable fields would've been better as one could hover over them and get more contextual information... but! The problem this seems to be solving is so custom that offering any sort of cookie cutter preset might be useless. Are you using all of those fields for your own needs?

There's a reason why even TanStack doesn't provide too much guidance around this field. You can put anything in there. As such, I'd expect people to want to customize this option with their own function anyway. Accepting a function should simplify the implementation a great deal as well.

If there is a preset worth providing, we might consider exporting it from the package itself so people could compose multiple functions together. Again, it comes back to the assumption that they'll want custom logic here

@ahmedrowaihi
Copy link
Contributor Author

I would suggest making this an optional function that's completely customizable as long as it returns a valid meta result. I believe those have to be objects?

I was about to write : meta: (operation): Object

The concern I have with having a boolean or an array of fields is that it deeply relies on the current operation model which might change. I'd almost say making it an object with toggleable fields would've been better as one could hover over them and get more contextual information... but! The problem this seems to be solving is so custom that offering any sort of cookie cutter preset might be useless. Are you using all of those fields for your own needs?

usually not all, partially, that's why this PR allows full operation model or partial

There's a reason why even TanStack doesn't provide too much guidance around this field. You can put anything in there. As such, I'd expect people to want to customize this option with their own function anyway. Accepting a function should simplify the implementation a great deal as well.

If there is a preset worth providing, we might consider exporting it from the package itself so people could compose multiple functions together. Again, it comes back to the assumption that they'll want custom logic here

reasonable

--
cooking ...

@ahmedrowaihi ahmedrowaihi force-pushed the main branch 2 times, most recently from ec2dcbc to 2e22877 Compare August 6, 2025 22:56
@ahmedrowaihi
Copy link
Contributor Author

@mrlubos here you go

@mrlubos
Copy link
Member

mrlubos commented Aug 6, 2025

@ahmedrowaihi any idea why the snapshots are mismatched?

@ahmedrowaihi
Copy link
Contributor Author

@ahmedrowaihi any idea why the snapshots are mismatched?

No idea, this happened also in previous PR, the snapshot setup seems like it needs a cleanup

@mrlubos
Copy link
Member

mrlubos commented Aug 7, 2025

@ahmedrowaihi double check you wiped all generated and snapshot folders before running it again, especially if you were adding/removing/renaming snapshots

@ahmedrowaihi
Copy link
Contributor Author

@ahmedrowaihi double check you wiped all generated and snapshot folders before running it again, especially if you were adding/removing/renaming snapshots

I just did that right now, let's hope this one pass

@ahmedrowaihi
Copy link
Contributor Author

finally it worked 🎉

@mrlubos
Copy link
Member

mrlubos commented Aug 7, 2025

@ahmedrowaihi I just merged an update to the docs, mind resolving the small conflict?

Copy link
Member

Choose a reason for hiding this comment

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

You can rename this file to just meta-function.test.ts since it's already in the TanStack folder

await Promise.all(
filePaths.map(async (filePath) => {
const fileContent = fs.readFileSync(filePath, 'utf-8');
await expect(fileContent).toMatchFileSnapshot(
Copy link
Member

Choose a reason for hiding this comment

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

The snapshot path could be cleaned up, currently it's stuff like packages/openapi-ts-tests/main/test/plugins/@tanstack/__snapshots__/3.1.x/plugins/@tanstack/@tanstack/vue-query.gen.ts. Something like packages/openapi-ts-tests/main/test/plugins/@tanstack/__snapshots__/meta/vue-query.gen.ts would be much cleaner

Copy link
Member

Choose a reason for hiding this comment

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

The main thing being:

  • there are too many @tanstacks in the path
  • no mention of "meta"
  • ideally mention of which TanStack version it's built for, though this is usually apparent from the file name (e.g. vue-query.gen.ts)

@ahmedrowaihi
Copy link
Contributor Author

@mrlubos there is something wierd, looks like the plugin is generting broken index.ts file after last changes

@ahmedrowaihi ahmedrowaihi requested a review from mrlubos August 7, 2025 02:40
@ahmedrowaihi
Copy link
Contributor Author

@mrlubos there is something wierd, looks like the plugin is generting broken index.ts file after last changes

whenever I try to move snapshots without making path @TanStack repeated, I find it either bugging or it's inconsistent with other conventions in the snapshots folders.

TBH, having multiple @TanStack is not big deal as if we will add more tools for tanstack it would live in same dir

@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Aug 7, 2025
Copy link
Member

@mrlubos mrlubos left a comment

Choose a reason for hiding this comment

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

Yes, test location isn't as important now. Approved!

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 7, 2025
@mrlubos
Copy link
Member

mrlubos commented Aug 8, 2025

Thanks for catching those broken links to Svelte docs, great attention to detail

@mrlubos mrlubos merged commit 036441a into hey-api:main Aug 8, 2025
13 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants