Skip to content
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

Performance fix for topbar component #1204

Merged
merged 2 commits into from
Jan 28, 2025
Merged

Conversation

AleksanderEvensen
Copy link
Contributor

@AleksanderEvensen AleksanderEvensen commented Jan 28, 2025

Description

closes none

Changes:
Replaces the scroll state with a simple boolean state isOver.
This reduces react re-renders from re-rendering on each scroll step, to only re-render once the trigger is reached.

I also took the time to remove the useMediaQuery (why do we have this) hook and replaced it with native CSS.

Screenshots:

React-Scan visualization before

brave_rJOpfXbzDs.mp4

React-Scan visualization after

brave_z6k5ZWa6Om.mp4

Responsive design with CSS media-queries

brave_PLpSwAtMNS.mp4

Pull request checklist

Please check if your PR fulfills the following requirements:

  • The PR includes a picture showing visual changes
  • Added Analytics-events if relevant
  • CHANGELOG.md has been updated. Guide

Copy link

vercel bot commented Jan 28, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
kvark ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 28, 2025 11:43am

Copy link
Contributor

@MadsNyl MadsNyl left a comment

Choose a reason for hiding this comment

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

Good

@AleksanderEvensen AleksanderEvensen merged commit 13af975 into dev Jan 28, 2025
5 checks passed
@AleksanderEvensen AleksanderEvensen deleted the perf/component-topbar branch January 28, 2025 11:44
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.

2 participants