Skip to content

: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.

fix(conversations): only warn about a missing support widget on support surfaces (#82424)

Georges-Antoine Assid016a9edb39d
diff --git a/products/conversations/frontend/components/SidePanel/sidepanelTicketsLogic.test.ts b/products/conversations/frontend/components/SidePanel/sidepanelTicketsLogic.test.ts
index 89504124a88e..9ebc1737086e 100644
--- a/products/conversations/frontend/components/SidePanel/sidepanelTicketsLogic.test.ts
+++ b/products/conversations/frontend/components/SidePanel/sidepanelTicketsLogic.test.ts
@@ -392,12 +392,20 @@ describe('sidepanelTicketsLogic', () => {
})
// The panel already shows free plans the community and upgrade options, and they have no email
- // channel, so warning them the chat failed would offer support they don't actually get.
+ // channel, so warning them the chat failed would offer support they don't actually get. The
+ // unread badge also mounts this logic on every page, so outside a support surface the toast
+ // would interrupt unrelated work (and block clicks under the toast container) for anyone whose
+ // ad blocker keeps the widget from loading.
it.each([
- ['warns an entitled plan', 'paid', true],
- ['stays quiet on a free plan', 'free', false],
- ])('when the widget never loads, %s', async (_case, subscriptionLevel, expectWarning) => {
+ ['warns an entitled plan on the support panel', 'paid', true, true],
+ ['stays quiet on a free plan', 'free', true, false],
+ ['stays quiet outside support surfaces', 'paid', false, false],
+ ])('when the widget never loads, %s', async (_case, subscriptionLevel, onSupportPanel, expectWarning) => {
const errorToast = jest.spyOn(lemonToast, 'error').mockReturnValue('' as never)
+ if (onSupportPanel) {
+ sidePanelStateLogic.mount()
+ sidePanelStateLogic.actions.openSidePanel(SidePanelTab.Support)
+ }
logic = sidepanelTicketsLogic.build()
logic.mount()
await expectLogic(logic).toFinishAllListeners()
@@ -425,7 +433,7 @@ describe('sidepanelTicketsLogic', () => {
([event]) => event === 'support widget load failed'
)
expect(loadFailures).toHaveLength(1)
- expect(loadFailures[0][1]).toMatchObject({ can_create_ticket: expectWarning })
+ expect(loadFailures[0][1]).toMatchObject({ can_create_ticket: subscriptionLevel === 'paid' })
expect(errorToast).toHaveBeenCalledTimes(expectWarning ? 1 : 0)
errorToast.mockRestore()
})
diff --git a/products/conversations/frontend/components/SidePanel/sidepanelTicketsLogic.ts b/products/conversations/frontend/components/SidePanel/sidepanelTicketsLogic.ts
index 30c9737424b7..5029c93e4cbd 100644
--- a/products/conversations/frontend/components/SidePanel/sidepanelTicketsLogic.ts
+++ b/products/conversations/frontend/components/SidePanel/sidepanelTicketsLogic.ts
@@ -473,22 +473,37 @@ export const sidepanelTicketsLogic = kea<sidepanelTicketsLogicType>([
if ((cache.conversationsRetries ?? 0) < 20) {
cache.conversationsRetries = (cache.conversationsRetries ?? 0) + 1
cache.conversationsRetryTimer = window.setTimeout(() => actions.loadTickets(), 500)
- } else if (!cache.conversationsUnavailableWarned) {
- // Out of retries. Kept separate from the send-failure event because nothing was
- // submitted here, and recorded even when we stay quiet so the rate is measurable.
- cache.conversationsUnavailableWarned = true
+ return
+ }
+ // Out of retries. Kept separate from the send-failure event because nothing was
+ // submitted here, and recorded even when we stay quiet so the rate is measurable.
+ if (!cache.conversationsUnavailableCaptured) {
+ cache.conversationsUnavailableCaptured = true
captureSupportWidgetLoadFailed({
surface: 'side_panel_tickets',
reason: 'extension_missing',
can_create_ticket: values.canCreateTicket,
})
- // Only warn people who could act on it. A free plan has no email fallback, and the
- // panel already shows them the community and upgrade options, so a toast offering
- // to email us would promise a channel they don't get. Warn while entitlement is
- // still unresolved, matching how the composer opens rather than drop a message.
- if (values.canCreateTicket || !values.isBillingResolved) {
- warnSupportWidgetUnavailable()
- }
+ }
+ // This logic also mounts from the panel bar's unread badge, which renders on every
+ // page, so an unavailable widget (an ad blocker is enough) would otherwise raise a
+ // persistent error toast on surfaces that have nothing to do with support and block
+ // clicks on whatever sits under the toast container. Only warn while the person is
+ // actually on a support surface; opening one later re-runs loadTickets and warns then.
+ const onSupportSurface =
+ (values.sidePanelOpen && values.selectedTab === SidePanelTab.Support) ||
+ removeProjectIdIfPresent(router.values.location.pathname) === urls.myTickets()
+ // Only warn people who could act on it. A free plan has no email fallback, and the
+ // panel already shows them the community and upgrade options, so a toast offering
+ // to email us would promise a channel they don't get. Warn while entitlement is
+ // still unresolved, matching how the composer opens rather than drop a message.
+ if (
+ !cache.conversationsUnavailableWarned &&
+ onSupportSurface &&
+ (values.canCreateTicket || !values.isBillingResolved)
+ ) {
+ cache.conversationsUnavailableWarned = true
+ warnSupportWidgetUnavailable()
}
return
}