Replies: 1 comment
-
|
An id is required for selects because the UI and routing requires one. The insert there is the optimistic insert which gets discarded when it loads the backend state. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I see that you can make fields optional by setting a default value in the schema, but it would be great to be able to pass different schemas for select, insert and update.
You can see a use case in the react projects example in this repository. The "select" schema's include all the fields which is awkward because the example goes through the effort to generate a random number for an id, even though it is omitted in the trpc layer anyway.
Additionally, there are benefits to having different schemas for insert and update. For example, databases being the source of truth for defaults for creation, and setting a default value for an update transaction could overwrite data when you are providing partial data.
Beta Was this translation helpful? Give feedback.
All reactions