Code Monkey home page Code Monkey logo

Comments (13)

anymaniax avatar anymaniax commented on May 30, 2024 4

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.

anymaniax avatar anymaniax commented on May 30, 2024 2

Support for suspense hooks will be in the next release

from orval.

codebutler avatar codebutler commented on May 30, 2024 1

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.

leniency avatar leniency commented on May 30, 2024 1

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.

leniency avatar leniency commented on May 30, 2024 1

Yeah, I think I have some time cleared up here so will send one in.

from orval.

melloware avatar melloware commented on May 30, 2024

I am open to anything supporting v5 as I love Orval and love Tanstack.

from orval.

anymaniax avatar anymaniax commented on May 30, 2024

Also since we expose a function to get the query options you can already use the suspense hook like that too

from orval.

anymaniax avatar anymaniax commented on May 30, 2024

@codebutler @melloware are you on discord? if yes could you ping me there?

from orval.

melloware avatar melloware commented on May 30, 2024

Yep I will ping you

from orval.

melloware avatar melloware commented on May 30, 2024

Can you offer a PR to fix it?

from orval.

hasanaktas avatar hasanaktas commented on May 30, 2024

Is there any progress on this issue?

from orval.

melloware avatar melloware commented on May 30, 2024

@hasanaktas I believe Orval 6.19.1 you can use Tanstack v5 with . Please test and let us know.

from orval.

hasanaktas avatar hasanaktas commented on May 30, 2024

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

#985

from orval.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.