← Back to Pull requests

⚡ Bolt: Eliminate layout thrashing during scroll via layout caching #45

Open
KingShadP opened this pull request with 71 lines diff across 2 files
View on GitHub
KingShadP KingShadP commented on Oct 26, 2026 16:24 UTC
Author

💡 What: Refactored the scroll event handlers for the navigation spy and the parallax effects in script.js. The offsetTop for sections and the getBoundingClientRect for parallax targets are now cached during setup and whenever the window resizes. Inside the requestAnimationFrame update loops, the calculations are now performed purely mathematically using these cached values and the current window.scrollY.

🎯 Why: Previously, the scroll handlers were continuously reading from the DOM (e.g., section.offsetTop and target.getBoundingClientRect()) which is an expensive operation that forces layout recalculations. By moving these reads entirely outside the scroll loop and only reacting to resize events, we eliminate layout thrashing.

📊 Impact: Reduces forced synchronous layouts and frame drops to zero during scrolling for the navigation and parallax calculations. This significantly improves FPS and ensures buttery smooth scrolling performance.

🔬 Measurement:
1. Open the Chrome DevTools Performance tab.
2. Record a trace while aggressively scrolling down and up the page.
3. Observe that there are no "Recalculate Style" or "Layout" warnings appearing inside the scroll event handling blocks, and that the CPU time spent in scripting during scroll is minimal.

---
PR created automatically by Jules for task 12814413764369648956 started by @KingShadP

Diff: 71 lines (+61 / -10) across 2 files Reviewer: copilot-pull-request-reviewer[bot] Review duration: 58011m
All Vouch review confidence checks passed
Residual risk 0.10 = Change Risk (0.37) × (1 − Review Confidence (0.74)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 71 lines diff across 2 files
0.37
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.56 · 4 substantive comment(s)
0.56
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
73%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.256
Real PR Conversation Timeline
6 items
google-labs-jules[bot] google-labs-jules[bot] commented on Oct 26, 2026 16:24 UTC
Bot

👋 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[bot] vercel[bot] commented on Oct 26, 2026 16:24 UTC
Bot

[vc]: #0MgyLP1BRoRko+SNJLcGyeWhl9o8k2AnT6XvW53aYf0=:eyJpc01vbm9yZXBvIjp0cnVlLCJ0eXBlIjoiZ2l0aHViIiwicHJvamVjdHMiOlt7Im5hbWUiOiJrc2hhZHAiLCJwcm9qZWN0SWQiOiJwcmpfcVpaVjhKWEpqeGRJalRiS09wbEpyVHdKTHNqdSIsImluc3BlY3RvclVybCI6Imh0dHBzOi8vdmVyY2VsLmNvbS9raW5nc2hhZHBzLXByb2plY3RzL2tzaGFkcC9Cb2NjSmJlblJ5dXk2akNlRFd2MVJYQXh3UmpLIiwicHJldmlld1VybCI6ImtzaGFkcC1naXQtYm9sdC1zY3JvbGwtbGF5b3V0LWNhY2hpbi02NDViM2Eta2luZ3NoYWRwcy1wcm9qZWN0cy52ZXJjZWwuYXBwIiwibmV4dENvbW1pdFN0YXR1cyI6IkRFUExPWUVEIiwibGl2ZUZlZWRiYWNrIjp7InJlc29sdmVkIjowLCJ1bnJlc29sdmVkIjowLCJ0b3RhbCI6MCwibGluayI6ImtzaGFkcC1naXQtYm9sdC1zY3JvbGwtbGF5b3V0LWNhY2hpbi02NDViM2Eta2luZ3NoYWRwcy1wcm9qZWN0cy52ZXJjZWwuYXBwIn0sInJvb3REaXJlY3RvcnkiOm51bGx9XX0=
The latest updates on your projects. Learn more about Vercel for GitHub.

| Project | Deployment | Actions | Updated |
| :--- | :----- | :------ | :------ |
| <a href="https://vercel.com/kingshadps-projects/kshadp"><sup><img src="https://vercel.com/api/www/avatar?projectId=prj_qZZV8JXJjxdIjTbKOplJrTwJLsju&teamId=team_0kLVvyQL2SLzfjEp0SuzuS4Z&s=32" width="16" height="16" align="middle" alt="" /></sup></a> kshadp | !Ready Ready | Preview | <relative-time datetime="2026-10-26T16:24:17.323Z">Oct 26, 2026 4:24pm UTC</relative-time> |

copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Oct 26, 2026 16:24 UTC
Reviewer

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

cloudflare-workers-and-pages[bot] cloudflare-workers-and-pages[bot] commented on Oct 26, 2026 16:24 UTC
Bot

Deploying new-project with &nbsp;<a href="https://pages.dev"><img alt="Cloudflare Pages" src="https://user-images.githubusercontent.com/23264/106598434-9e719e00-654f-11eb-9e59-6167043cfa01.png" width="16"></a> &nbsp;Cloudflare Pages

<table><tr><td><strong>Latest commit:</strong> </td><td>
<code>9d3c7d1</code>
</td></tr>
<tr><td><strong>Status:</strong></td><td>&nbsp;✅&nbsp; Deploy successful!</td></tr>
<tr><td><strong>Preview URL:</strong></td><td>
<a href='https://87420a42.new-project-3vm.pages.dev'>https://87420a42.new-project-3vm.pages.dev</a>
</td></tr>
<tr><td><strong>Branch Preview URL:</strong></td><td>
<a href='https://bolt-scroll-layout-caching-1.new-project-3vm.pages.dev'>https://bolt-scroll-layout-caching-1.new-project-3vm.pages.dev</a>
</td></tr>
</table>

View logs

cloudflare-workers-and-pages[bot] cloudflare-workers-and-pages[bot] commented on Oct 26, 2026 17:04 UTC
Bot

Deploying with &nbsp;<a href="https://workers.dev"><img alt="Cloudflare Workers" src="https://workers.cloudflare.com/logo.svg" width="16"></a> &nbsp;Cloudflare Workers


The latest updates on your project. Learn more about integrating Git with Workers.

| Status | Name | Latest Commit | Updated (UTC) |
| -|-|-|-|
| ❌ Deployment failed <br>View logs | new-kingshadsite | 9d3c7d1c | Oct 26 2026, 04:24 PM |

Assignees
KingShadP KingShadP
Labels
risk: low confidence: 73.8% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 37% (MEDIUM) · Higher = larger blast radius
37%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 73.8% · Lower = rushed or shallow review
73.8%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 9.7% · Safe to merge
9.7%