Skip to content

Fix heatmap snapshot height being set by a single tall outlier click - #4648

Open
drakeo338 wants to merge 1 commit into
umami-software:devfrom
drakeo338:claude/4647-fix
Open

drakeo338 wants to merge 1 commit into
umami-software:devfrom
drakeo338:claude/4647-fix

Conversation

@drakeo338

@drakeo338 drakeo338 commented Oct 20, 2026 •

Copy link
Copy Markdown

Fixes #4647.

The heatmap snapshot height came from the largest pageH among clicks in the chosen viewport, so one click recorded while the page was temporarily taller (an open modal, say) stretched the frame for every dot and shifted bottom-anchored elements away from the recorded clicks. pickSnapshotViewport now uses the pageH shared by most clicks, raised only as far as the lowest click needs. Added tests for the outlier case; they fail on the old code and pass now.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

pickSnapshotViewport used the largest pageH of the winning viewport as
the snapshot size, so one click recorded on a taller page stretched the
snapshot for every dot. Use the pageH shared by most clicks instead,
raised only as far as the lowest click needs.
@vercel

vercel Bot commented Oct 20, 2026

Copy link
Copy Markdown

@drakeo338 is attempting to deploy a commit to the Umami Software Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps

greptile-apps Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The change is limited to snapshot sizing in the heatmap click workflow.

Fix the frame-height interaction before merging so clicks below the first screen remain visible.

Findings

  1. P1 Clicks below the screen disappear ▶
  2. P2 Tests miss click-count mistakes ▶

Summary

Changes pickSnapshotViewport to choose the most common pageH by click count, then extend it to the deepest click.

  • Heatmap snapshots stay near the usual page height while including clicks.

Reviews (1) · Last reviewed commit: "Fix heatmap snapshot height being set by..." · Reviewed by Greptile

height: bestViewport.height,
pageW: bestViewport.maxPageW,
pageH: bestViewport.maxPageH,
pageH: Math.max(commonPageH, Math.ceil(bestViewport.maxPageY)),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Clicks below the screen disappear

With viewportH=900, three clicks at pageH=900, and one click at pageY=1000 with pageH=2239, this returns pageH=1000. But getSnapshotFrameHeight turns heights up to 1125 back into 900, so the canvas clips the click at 1000. Previously, the frame was 2239 tall and showed that click. Update the frame-height rule alongside this change so extending to the deepest click actually keeps it visible.

Comment on lines +25 to +28
it('ignores a single taller outlier pageH', () => {
const result = pickSnapshotViewport([point(865, 900, 3), point(450, 900), point(449, 2239)]);

expect(result?.pageH).toBe(900);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Tests miss click-count mistakes

These tests do not check that count decides the most common height. In the outlier test, 900 wins both by clicks and by number of point rows, so ignoring count would still pass. Add a case where one row has more clicks than several rows at another height. Also cover equal totals to protect the new larger-height tie rule.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant