T
TanStack4mo ago
conventional-tan

How to get update server id after onInsert?

In onInsert I'm calling my TRPC endpoint which return the server generate Public ID of the newly inserted item. How can I access that data where I called Collection.insert?
No description
No description
4 Replies
rare-sapphire
rare-sapphire4mo ago
hmm good question — the transaction itself would be the logical place to put this information as it's what connects the two call sites. But it doesn't have a way to put response data on it atm we should add something for this
conventional-tan
conventional-tanOP4mo ago
Yeah I thought the same thing 😄 Should I file an issue?
rare-sapphire
rare-sapphire4mo ago
yes please 😄
conventional-tan
conventional-tanOP4mo ago
GitHub
Adding server-generated properties to transaction in Collection.onI...
In my onInsert handler, I call a TRPC endpoint which returns the server-generated publicId of the newly created document: onInsert: async ({ transaction }) => { const newDocument = transaction.m...

Did you find this page helpful?