nicoalbanese / kirimase

Build full-stack Next.js apps, incredibly fast
https://kirimase.dev
MIT License
2.37k stars 107 forks source link

[Question] Validation when doing partial updates? #180

Open trevorpfiz opened 3 months ago

trevorpfiz commented 3 months ago

I noticed that the update mutations expect the full object passed in. Is this because of the optimistic updates? How should we best handle cases where we only want to update part of the schema? Use .partial()?

These are the relevant bits of code I am referring to

export const updateReportSchema = baseSchema;
export const updateReportParams = baseSchema
  .extend({
    patientId: z.coerce.string().min(1),
  })
  .omit({
    userId: true,
  });
export const updateReport = async (
  id: ReportId,
  report: UpdateReportParams,
) => {
crbon commented 6 days ago

Interested in this also