Skip to content

Fix duplicate data-layer calls during build#16986

Merged
wackerow merged 1 commit into
devfrom
fix/dedupe-data-layer-cache
Dec 27, 2025
Merged

Fix duplicate data-layer calls during build#16986
wackerow merged 1 commit into
devfrom
fix/dedupe-data-layer-cache

Conversation

@pettinarip
Copy link
Copy Markdown
Member

I noticed we were hitting Netlify Blobs multiple times for the same data during static generation. For example, getGrowThePieData was being called 6 times instead of once when building the layer-2 pages.

The issue: Next.js renders each page twice during build (data collection + HTML generation), and unstable_cache alone doesn't deduplicate within the same render cycle.

The fix: Wrap our cached getters with React's cache() function, which memoizes calls within the same request/render. Now we get:

  • cache() → deduplication within same render
  • unstable_cache → persistence across requests with time-based revalidation

Before: ~6 calls per data source during build
After: ~2 calls (one per worker process)

@netlify
Copy link
Copy Markdown

netlify Bot commented Dec 23, 2025

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit e2eb1b7
🔍 Latest deploy log https://app.netlify.com/projects/ethereumorg/deploys/694a978be289af0008531fe2
😎 Deploy Preview https://deploy-preview-16986--ethereumorg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
7 paths audited
Performance: 56 (🟢 up 4 from production)
Accessibility: 94 (no change from production)
Best Practices: 100 (🟢 up 2 from production)
SEO: 100 (no change from production)
PWA: 59 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the tooling 🔧 Changes related to tooling of the project label Dec 23, 2025
@wackerow wackerow merged commit 3195e9e into dev Dec 27, 2025
6 checks passed
@wackerow wackerow deleted the fix/dedupe-data-layer-cache branch December 27, 2025 14:56
@wackerow wackerow mentioned this pull request Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tooling 🔧 Changes related to tooling of the project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants