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(web-analytics): Prevent wildcard from being reset when changing widths (#90480)

Jordan Mryyandea25741b7a0
diff --git a/products/web_analytics/frontend/heatmaps/components/heatmapsBrowserLogic.ts b/products/web_analytics/frontend/heatmaps/components/heatmapsBrowserLogic.ts
index 03c17d8df60d..b1cc8a7207c4 100644
--- a/products/web_analytics/frontend/heatmaps/components/heatmapsBrowserLogic.ts
+++ b/products/web_analytics/frontend/heatmaps/components/heatmapsBrowserLogic.ts
@@ -652,13 +652,13 @@ export const heatmapsBrowserLogic = kea<heatmapsBrowserLogicType>([
listeners(({ actions, props, values, cache, selectors }) => ({
setDisplayUrl: ({ url }, _, __, previousState) => {
- // Don't clobber a separately edited data URL when the page URL changes.
- if (!values.userTouchedDataUrl) {
+ const previousDisplayUrl = selectors.displayUrl(previousState)
+ const dataUrlWasFollowingDisplayUrl = selectors.dataUrl(previousState) === previousDisplayUrl
+
+ if (!values.userTouchedDataUrl && dataUrlWasFollowingDisplayUrl) {
actions.setDataUrl(url?.trim() ?? null)
}
- // the iframe loads displayUrl, so only an actual change produces a load
- // event; arming on anything else leaves a timer nothing can cancel
- if (url?.trim().length && url !== selectors.displayUrl(previousState)) {
+ if (url?.trim().length && url !== previousDisplayUrl) {
actions.startTrackingLoading()
}
},