-
-
Notifications
You must be signed in to change notification settings - Fork 273
feat(tanstack-query): introduce meta, and operation meta tags #2399
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
|
|
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: f89e478 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 Report❌ Patch coverage is 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
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:
|
commit: |
packages/openapi-ts-tests/main/test/tanstack-query-meta.test.ts
Outdated
Show resolved
Hide resolved
|
@ahmedrowaihi is attempting to deploy a commit to the Hey API Team on Vercel. A member of the Team first needs to authorize it. |
|
@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? |
I am all ears ! tell me
true, will use smaller one |
|
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 |
I was about to write :
usually not all, partially, that's why this PR allows
reasonable -- |
ec2dcbc to
2e22877
Compare
|
@mrlubos here you go |
|
@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 |
|
@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 |
|
finally it worked 🎉 |
|
@ahmedrowaihi I just merged an update to the docs, mind resolving the small conflict? |
packages/openapi-ts/src/plugins/@tanstack/svelte-query/types.d.ts
Outdated
Show resolved
Hide resolved
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.
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( |
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.
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
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.
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)
packages/openapi-ts-tests/main/test/plugins/@tanstack/__snapshots__/meta/index.ts
Fixed
Show fixed
Hide fixed
…ties and serializers
packages/openapi-ts-tests/main/test/plugins/@tanstack/__snapshots__/meta/types.ts
Fixed
Show fixed
Hide fixed
packages/openapi-ts-tests/main/test/plugins/@tanstack/__snapshots__/meta/types.ts
Fixed
Show fixed
Hide fixed
packages/openapi-ts-tests/main/test/plugins/@tanstack/__snapshots__/meta/types.ts
Fixed
Show fixed
Hide fixed
packages/openapi-ts-tests/main/test/plugins/@tanstack/__snapshots__/meta/types.ts
Fixed
Show fixed
Hide fixed
packages/openapi-ts-tests/main/test/plugins/@tanstack/__snapshots__/meta/types.ts
Fixed
Show fixed
Hide fixed
packages/openapi-ts-tests/main/test/plugins/@tanstack/__snapshots__/meta/types.ts
Fixed
Show fixed
Hide fixed
packages/openapi-ts-tests/main/test/plugins/@tanstack/__snapshots__/meta/types.ts
Fixed
Show fixed
Hide fixed
packages/openapi-ts-tests/main/test/plugins/@tanstack/__snapshots__/meta/types.ts
Fixed
Show fixed
Hide fixed
packages/openapi-ts-tests/main/test/plugins/@tanstack/__snapshots__/meta/types.ts
Fixed
Show fixed
Hide fixed
packages/openapi-ts-tests/main/test/plugins/@tanstack/__snapshots__/meta/types.ts
Fixed
Show fixed
Hide fixed
packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/index.ts
Fixed
Show fixed
Hide fixed
packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/types.ts
Fixed
Show fixed
Hide fixed
packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/types.ts
Fixed
Show fixed
Hide fixed
packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/types.ts
Fixed
Show fixed
Hide fixed
packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/types.ts
Fixed
Show fixed
Hide fixed
packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/types.ts
Fixed
Show fixed
Hide fixed
packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/types.ts
Fixed
Show fixed
Hide fixed
packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/types.ts
Fixed
Show fixed
Hide fixed
packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/types.ts
Fixed
Show fixed
Hide fixed
packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/types.ts
Fixed
Show fixed
Hide fixed
|
@mrlubos there is something wierd, looks like the plugin is generting broken index.ts file after last changes |
…in meta function signatures
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 |
mrlubos
left a comment
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.
Yes, test location isn't as important now. Approved!
|
Thanks for catching those broken links to Svelte docs, great attention to detail |
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