Skip to content

feat: hide toolbar elements when hidden #31150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 11, 2025
Merged

Conversation

pauldambra
Copy link
Member

we're now able to load way more elements into the clickmap

that means that the page can get overloaded

we're also tracking visibility of the elements highlighted by the click map

so, we can hide the, erm, hidden elements

before after
2025-04-11 21 53 30 2025-04-11 21 49 41

@pauldambra pauldambra requested review from a team, sortafreel and veryayskiy and removed request for a team April 11, 2025 20:55
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR optimizes the PostHog toolbar by filtering out hidden elements from the clickmap display, improving performance when loading large numbers of elements.

  • Added visible property to ElementWithMetadata interface in frontend/src/toolbar/types.ts to track element visibility
  • Modified elementsToDisplay selector in elementsLogic.ts to filter out elements that are hidden or have zero/negative dimensions
  • Updated Elements.tsx to add visibility checks before rendering heatmap elements and labels
  • Improved performance by preventing rendering of invisible elements, reducing page overload when many elements are loaded

Greptile AI

3 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

Copy link
Contributor

Size Change: +77 B (0%)

Total Size: 13.2 MB

ℹ️ View Unchanged
Filename Size Change
frontend/dist/toolbar.js 13.2 MB +77 B (0%)

compressed-size-action

@pauldambra pauldambra enabled auto-merge (squash) April 11, 2025 21:18
@pauldambra pauldambra merged commit 72ec89c into master Apr 11, 2025
108 of 109 checks passed
@pauldambra pauldambra deleted the feat/hide-when-erm-hidden branch April 11, 2025 21:26
lricoy pushed a commit that referenced this pull request Apr 14, 2025
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
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.

3 participants