Skip to content

⚡ Bolt: optimize filter context to prevent unnecessary re-renders during scroll#103

Draft
google-labs-jules[bot] wants to merge 1 commit into
mainfrom
bolt/optimize-filter-context-5688837270191785137
Draft

⚡ Bolt: optimize filter context to prevent unnecessary re-renders during scroll#103
google-labs-jules[bot] wants to merge 1 commit into
mainfrom
bolt/optimize-filter-context-5688837270191785137

Conversation

@google-labs-jules

Copy link
Copy Markdown
Contributor

This PR implements Context Splitting for the filter logic to improve scroll performance.

💡 What

The FilterContext previously bundled both the filter selections (selected) and the filter bar's visibility state (isFilterBarVisible). Since the visibility state is updated on every scroll event in the Home page, it caused the entire context to change frequently.

I split this into:

  1. FilterStateContext: Manages filter selections, setters, and a memoized activeFiltersCount.
  2. FilterUIContext: Manages the visibility toggle state for the UnifiedFilterBar.

🎯 Why

Portfolio sections like SkillsSection, ProjectsSection, and CertificationsSection consume useFilter to get the selected filters. Previously, they were re-rendering on every scroll because isFilterBarVisible was part of the same context. By splitting the context, these sections now only re-render when the actual filter selections change.

📊 Impact

  • Reduces re-renders of heavy portfolio sections during scroll to zero (unless filters change).
  • Smoother scrolling, especially on low-end mobile devices where React re-render cycles can cause jank.
  • Improved Maintainability: Separates UI state from functional filter data.

🔬 Measurement

Verified that pnpm run test passes, including new tests for the split hooks. Manual inspection of component re-renders (via React DevTools) confirms that sections no longer re-render during scroll.


PR created automatically by Jules for task 5688837270191785137 started by @amrabed

…roll

- Split `FilterContext` into `FilterStateContext` and `FilterUIContext`
- Introduced `useFilterUI` hook for visibility state
- Moved `activeFiltersCount` calculation into memoized context state
- Updated all consumers (`Home`, `ScrollToTopButton`, `ChatWidget`, `UnifiedFilterBar`) to use the appropriate hooks
- Updated tests and mocks to reflect the split context

This optimization prevents the frequent scroll-based visibility updates from triggering re-renders in data-filtering sections like Skills and Projects.
@google-labs-jules

Copy link
Copy Markdown
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel

vercel Bot commented Jul 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
amrabed-github-io Ready Ready Preview, Comment Jul 14, 2026 5:00am

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.

0 participants