:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(support): prevent duplicate Zendesk tickets on rapid Submit clicks (#59055)
HaynesPostHog0c12e63ea69d
diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/support/SidePanelSupport.tsx b/frontend/src/layout/navigation-3000/sidepanel/panels/support/SidePanelSupport.tsxindex e81781051f6e..dc19a33e4ec4 100644--- a/frontend/src/layout/navigation-3000/sidepanel/panels/support/SidePanelSupport.tsx+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/support/SidePanelSupport.tsx@@ -264,9 +264,11 @@ const SupportResponseTimesTable = ({function SupportFormBlock({onCancel,billing,+ isSubmitting,}: {onCancel: () => voidbilling: BillingType | null | undefined+ isSubmitting: boolean}): JSX.Element {return (<Section title="Email an engineer">@@ -279,6 +281,7 @@ function SupportFormBlock({fullWidthcenterclassName="mt-4"+ loading={isSubmitting}>Submit</LemonButton>@@ -307,7 +310,12 @@ export function SidePanelSupport(): JSX.Element {const { preflight } = useValues(preflightLogic)const { featureFlags } = useValues(featureFlagLogic)useValues(userLogic)- const { isEmailFormOpen, title: supportPanelTitle, targetArea } = useValues(supportLogic)+ const {+ isEmailFormOpen,+ title: supportPanelTitle,+ targetArea,+ isSendSupportRequestSubmitting,+ } = useValues(supportLogic)const { closeEmailForm, openEmailForm, closeSupportForm, resetSendSupportRequest } = useActions(supportLogic)const { billing, billingLoading, billingPlan } = useValues(billingLogic)const { isCurrentOrganizationNew } = useValues(organizationLogic)@@ -344,6 +352,7 @@ export function SidePanelSupport(): JSX.Element {{isEmailFormOpen && showEmailSupport && isBillingLoaded && !useProductSupportSidePanel ? (<SupportFormBlockbilling={billing}+ isSubmitting={isSendSupportRequestSubmitting}onCancel={() => {closeEmailForm()closeSupportForm()diff --git a/frontend/src/lib/components/Support/SupportModal.tsx b/frontend/src/lib/components/Support/SupportModal.tsxindex fb0174200df8..36e357c9f843 100644--- a/frontend/src/lib/components/Support/SupportModal.tsx+++ b/frontend/src/lib/components/Support/SupportModal.tsx@@ -13,7 +13,7 @@ import { SupportForm } from './SupportForm'import { supportLogic } from './supportLogic'function SupportModal({ onAfterClose }: { onAfterClose: () => void }): JSX.Element | null {- const { sendSupportRequest, isSupportFormOpen, title } = useValues(supportLogic)+ const { sendSupportRequest, isSupportFormOpen, title, isSendSupportRequestSubmitting } = useValues(supportLogic)const { closeSupportForm, resetSendSupportRequest } = useActions(supportLogic)const { isCloudOrDev } = useValues(preflightLogic)const { sidePanelAvailable } = useValues(sidePanelStateLogic)@@ -45,7 +45,13 @@ function SupportModal({ onAfterClose }: { onAfterClose: () => void }): JSX.Eleme>Cancel</LemonButton>- <LemonButton form="support-modal-form" htmlType="submit" type="primary" data-attr="submit">+ <LemonButton+ form="support-modal-form"+ htmlType="submit"+ type="primary"+ data-attr="submit"+ loading={isSendSupportRequestSubmitting}+ >Submit</LemonButton></div>diff --git a/frontend/src/lib/components/Support/supportLogic.ts b/frontend/src/lib/components/Support/supportLogic.tsindex 21f687c8f0c9..521f2dfc54cb 100644--- a/frontend/src/lib/components/Support/supportLogic.ts+++ b/frontend/src/lib/components/Support/supportLogic.ts@@ -459,7 +459,7 @@ export const supportLogic = kea<supportLogicType>([},],})),- forms(({ actions, values }) => ({+ forms(({ values }) => ({sendSupportRequest: {defaults: {name: '',@@ -471,9 +471,9 @@ export const supportLogic = kea<supportLogicType>([} as SupportFormFields,errors: ({ name, email, message, kind, target_area, severity_level }) => {return {- name: !values.user ? (!name ? 'Please enter your name' : '') : '',- email: !values.user ? (!email ? 'Please enter your email' : '') : '',- message: !message ? 'Please enter a message' : '',+ name: !values.user && !name ? 'Please enter your name' : undefined,+ email: !values.user && !email ? 'Please enter your email' : undefined,+ message: !message ? 'Please enter a message' : undefined,kind: !kind ? 'Please choose' : undefined,severity_level: !severity_level ? 'Please choose' : undefined,target_area: !target_area ? 'Please choose' : undefined,@@ -483,9 +483,7 @@ export const supportLogic = kea<supportLogicType>([// name must be present for zendesk to accept the ticketformValues.name = values.user?.first_name ?? formValues.name ?? 'name not set'formValues.email = values.user?.email ?? formValues.email ?? ''- actions.submitZendeskTicket(formValues)- // Form closing and resetting is now handled in submitZendeskTicket listener- // based on success/failure of the submission+ await supportLogic.asyncActions.submitZendeskTicket(formValues)},},})),