Theo's Typesafe CultTTC
Theo's Typesafe Cultβ€’3y agoβ€’
12 replies
Debaucus

tRPC query 'train'. what's the correct method to grab data from multiple sources?

I'm going to make an example as I'm either struggling to understand or am building my database wrong.

A user has a profile page, to load this profile page we use the URL value.

So I query tRPC when the username is entered into the URL /profile/Debaucus

I now get back the details for Debaucus, it's a real page.

Next, I want to query all the users posts, stored in a separate table, called posts.

If I make a new tRPC query, I get the 'too many re-renders' as I am doing multiple chains, as I am using the ID recovered from the first query in the second

Load page > use slug for tRPC query to get data > use that data to tRPC query more data?

Is this incorrect methodology?
Was this page helpful?