: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(conversations): stop unsaved-changes prompt re-firing on tickets (#66294)
Abigaileaabedbee45d
diff --git a/products/conversations/frontend/scenes/ticket/supportTicketSceneLogic.ts b/products/conversations/frontend/scenes/ticket/supportTicketSceneLogic.tsindex c414de6f770c..701815cbaff3 100644--- a/products/conversations/frontend/scenes/ticket/supportTicketSceneLogic.ts+++ b/products/conversations/frontend/scenes/ticket/supportTicketSceneLogic.ts@@ -580,8 +580,24 @@ export const supportTicketSceneLogic = kea<supportTicketSceneLogicType>([cache.disposables.disposeAll()impersonationNoticeLogic.findMounted()?.actions.setTicketContext(null)}),- beforeUnload(({ values }) => ({- enabled: () => values.hasPendingWork,+ beforeUnload(({ values, actions }) => ({+ enabled: (newLocation) => {+ if (!values.hasPendingWork) {+ return false+ }+ // Ignore in-page navigations (e.g. opening a side panel) that keep the same path+ if (newLocation && newLocation.pathname === router.values.location.pathname) {+ return false+ }+ return true+ },message: 'You have unsaved changes. Are you sure you want to leave?',+ onConfirm: () => {+ // Re-sync local form reducers to the last-known server ticket so hasUnsavedChanges+ // recomputes to false and the prompt does not re-fire on the next navigation.+ if (values.ticket) {+ actions.setTicket(values.ticket)+ }+ },})),])