Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Log a lead form change only when the form changed

Rafi22107b7e845f
diff --git a/apps/web/lib/submitted-leads/update-submitted-lead-form-action.ts b/apps/web/lib/submitted-leads/update-submitted-lead-form-action.ts
index b050ce980e..c7a3ffb631 100644
--- a/apps/web/lib/submitted-leads/update-submitted-lead-form-action.ts
+++ b/apps/web/lib/submitted-leads/update-submitted-lead-form-action.ts
@@ -133,11 +133,13 @@ export const updateSubmittedLeadFormAction = authActionClient
);
}
- // The form is the same on every group, so log a form change only once
+ // The form is the same on every group, so log a form change only once.
+ // Parse the old form so both forms have their keys in the same order.
if (
group.slug === DEFAULT_PARTNER_GROUP.slug &&
- JSON.stringify(oldReferralFormData) !==
- JSON.stringify(referralFormData)
+ JSON.stringify(
+ submittedLeadFormSchema.safeParse(oldReferralFormData).data,
+ ) !== JSON.stringify(referralFormData)
) {
descriptions.push("Submitted lead form updated for all groups");
}