tRPCttRPC
Powered by
bigtechguyB
tRPC•3y ago•
3 replies
bigtechguy

useContext utils getData always returning undefined

I have my app set up with TRPC and when trying to call


  const utils = trpc.useContext();
  const utils = trpc.useContext();

const cart = utils.cart.getCart.getData();
const cart = utils.cart.getCart.getData();


The data always winds up as
undefined
undefined
even though I can see the data populated in the query cache. Is there any special gotchas with using these utils?


    "@trpc/client": "^10.37.1",
    "@trpc/next": "^10.37.1",
    "@trpc/react-query": "^10.37.1",
    "@trpc/server": "^10.37.1",

    "next": "13.4.12",
    "@trpc/client": "^10.37.1",
    "@trpc/next": "^10.37.1",
    "@trpc/react-query": "^10.37.1",
    "@trpc/server": "^10.37.1",

    "next": "13.4.12",
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

infiniteQuery always undefined cursor
avalleteAavallete / ❓-help
3y ago
createTRPCNext config ctx always returns undefined.
MonkeyStructMMonkeyStruct / ❓-help
3y ago
useContext not Invalidating
typedefTtypedef / ❓-help
3y ago