Zhou (Link) Fang
Zhou (Link) Fang
TtRPC
Created by MiNiMAL on 10/15/2023 in #❓-help
Dynamic input not leading to changes on the front end
Just found a similar question and sadly the answer is no, dynamically infer type based on input is not doable atm. Reference: https://trpc.io/docs/faq#can-i-dynamically-return-a-different-output-depending-on-what-input-i-send Simiar question: https://discord.com/channels/867764511159091230/1131680860387684422/1132657491516346468
4 replies
TtRPC
Created by MiNiMAL on 10/15/2023 in #❓-help
Dynamic input not leading to changes on the front end
Having the same issue using Prisma. I think this is a common usage, not sure how everyone solves this issue? Quite some tables might have relationships with other tables and those properties will not be included in the query data by default. But we can pass "include" to include those additional info when needed and unfortunately, trpc will not infer the type on the fly based on the actual input when we do the query, but just using the default type... e.g., a person item would be { name: 'Bob', title: 'Developer' } or { name: 'Bob', title: 'Developer', projects: [{name: 'project a'}, {name: 'project b'}] }
4 replies