Comments (13)
I did some preparation for the v5 not long ago. We just need to add the new suspense hook and we should be good form what I know
from orval.
Support for suspense hooks will be in the next release
from orval.
Support for suspense was moved into its own hook, so without changes to orval there will be no way to continue using that.
We could consider the approach taken by this compiler which returns a query options object that can be used with either hook: https://github.com/connectrpc/connect-query-es#quickstart
See the "Why does it work this way?" section in the FAQ https://github.com/connectrpc/connect-query-es#frequently-asked-questions
from orval.
I just tried and ran into a typescript issue. It looks like queryKey
is now required so calling the generated use hooks with additional query options raises typescript errors:
const { data } = useGetMyQuery({
query: {
// Raises a typescript error here that the queryKey is required, but it's being set
// in the generated code. This creates an annoyance here if all we want to do
// is just set some other option and don't want to re-declare the query key.
}
});
In the generated endpoint, this can be solved by wrapping the options.query type in a Partial<>
in the endpoint hook and the options function:
export const useGetMyQuery= <TData = Awaited<ReturnType<typeof getMyQuery>>, TError = ErrorType<void>>(
options?: { query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getMyQuery>>, TError, TData>>, }
): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
...
}
from orval.
Yeah, I think I have some time cleared up here so will send one in.
from orval.
I am open to anything supporting v5 as I love Orval and love Tanstack.
from orval.
Also since we expose a function to get the query options you can already use the suspense hook like that too
from orval.
@codebutler @melloware are you on discord? if yes could you ping me there?
from orval.
Yep I will ping you
from orval.
Can you offer a PR to fix it?
from orval.
Is there any progress on this issue?
from orval.
@hasanaktas I believe Orval 6.19.1 you can use Tanstack v5 with . Please test and let us know.
from orval.
@melloware
In our tests, we did not see any problems in general with the requests made on the client side.
The issue here needs to be resolved for more testing because we have a lot of requests submitted on the ssr side.
from orval.
Related Issues (20)
- TypeScript: Variable is used before being assigned / Block-scoped variable used before its declaration
- "WARNING: `import.meta` is not available" after updating to 6.24.0 HOT 11
- Support for Svelte Query v5 HOT 1
- Node16 or bundler module resolution causes TS2742 error HOT 1
- Missing import of enum const in generated mock when using split mode HOT 5
- Mock TypeError custom override HOT 7
- Possibility of TS2563 error for mock generation HOT 5
- TS2300 Duplicate identifier: duplicated imports when `mock` enabled HOT 7
- Allow overriding entire handler function in generated MSW handlers, not just response object
- Invalid typescript generation for empty schema HOT 4
- msw generation does not import used models HOT 1
- Mock generation doesn't guarantee the required property mocking
- Is possible ignore the changes in the line of OpenAPI spec version ? HOT 2
- Another duplicate export edge case
- Specify mock property overrides for a specific schema HOT 2
- Support replacing types with custom ones when transforming the input HOT 5
- React Query: Regression in 6.25.0 caused by #1207 HOT 5
- Is possible ignore the changes in the line of OpenAPI spec version ?
- Orval generates wrong import paths in ESM-only package HOT 3
- Pass an additional option object in fetcher function when using custom axios instance HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from orval.