Git Product home page Git Product logo

Comments (7)

KATT avatar KATT commented on June 14, 2024 1

You're free to make a PR to implement, but we'd have to update

  • utils proxy
  • any SSR fetcher
  • all of useQuery/ useInfiniteQuery / [...]

Not sure if it's worth the squeeze, we've had 3 years of no one reporting an issue related to this so it feels like an edge-case and I'd like us to just piggy-back on RQ's hash fn that works great for the 99% use-case

AFAIK, you can still pass the hashQueryFn in tRPC as well as we just forward the options from RQ

from trpc.

KATT avatar KATT commented on June 14, 2024

If this is a bug, it's with 95% probability a bug in https://github.com/TanStack/query and not tRPC

from trpc.

juliusmarminge avatar juliusmarminge commented on June 14, 2024

Sandbox with raw RQ: https://stackblitz.com/edit/github-wgxcnf?file=src%2Findex.jsx

The first one represents the flow tRPC would work. We don't serialize the input before using is as a query key, so the query doesn't update.

We could "fix" this in trpc by transforming input before using is as a query key, although I'm not sure how wise that is 🤔

CleanShot.2024-04-25.at.11.01.12.mp4

from trpc.

KATT avatar KATT commented on June 14, 2024

Yeah, this is most likely an issue in RQ's getQueryKey, but we shouldn't fix it in tRPC.

@BrendanC23 could you open an issue at https://github.com/TanStack/query using @juliusmarminge' sandbox above?

from trpc.

BrendanC23 avatar BrendanC23 commented on June 14, 2024

I created this React Query issue. They will not fix it on their end.

we only support json serializable values in the key. If you need something more, you can provide your own queryKeyHashFn and use something like superjson to serialize Sets.

from trpc.

KATT avatar KATT commented on June 14, 2024

Yeahhhhh..... I don't think we'll do this.

There are a lot of places we depend on the query hash being whatever RQ produces so I think it'll be quite hairy to make this work.

I'd advise you not to use Sets as an input argument. Personally, I only use JSON-serializable values as it maps better to React and <form>s etc, and if something needs to be a complex type, i use .transform(() => on code zod schema

from trpc.

github-actions avatar github-actions commented on June 14, 2024

This issue has been locked because we are very unlikely to see comments on closed issues. If you are running into a similar issue, please create a new issue. Thank you.

from trpc.

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.