Skip to content

⚡ Bolt: Optimize generateStaticParams with Promise.all for faster build times#65

Open
anyulled wants to merge 2 commits intomainfrom
bolt-optimize-static-params-2939554868812199014
Open

⚡ Bolt: Optimize generateStaticParams with Promise.all for faster build times#65
anyulled wants to merge 2 commits intomainfrom
bolt-optimize-static-params-2939554868812199014

Conversation

@anyulled
Copy link
Owner

@anyulled anyulled commented Feb 28, 2026

💡 What: Replaced sequential asynchronous fetching loops with Promise.all in generateStaticParams across the talks/[talkId], speakers/[speakerId], and tags/[tag] dynamic pages. Added a journal entry to document the pattern.
🎯 Why: The sequential loops iterated through every available conference year, fetching data one year at a time. This created a significant bottleneck during the Static Site Generation (SSG) phase of the build process.
📊 Impact: Considerably faster static generation phase during next build, as data for all years is now fetched in parallel. The time to generate static params drops from O(n) to O(1) in relation to the number of conference years.
🔬 Measurement: Run npm run build and observe the reduced time to collect page data. No changes in functionality (as validated by npm run test).


PR created automatically by Jules for task 2939554868812199014 started by @anyulled

Summary by CodeRabbit

  • Documentation

    • Added guidance on optimizing data fetching during static generation using concurrent operations.
  • Refactor

    • Enhanced build performance by parallelizing static page generation across multiple route segments, reducing generation time while maintaining error resilience.

…ld times

Replaced sequential asynchronous fetching loops in `generateStaticParams`
with `Promise.all` across `app/[year]/talks/[talkId]/page.tsx`,
`app/[year]/speakers/[speakerId]/page.tsx`, and `app/[year]/tags/[tag]/page.tsx`.
This correctly parallelizes fetching for all conference years during static
generation, significantly reducing the build time bottleneck.

Co-authored-by: anyulled <100741+anyulled@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 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
Copy link

vercel bot commented Feb 28, 2026

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

Project Deployment Actions Updated (UTC)
devbcn Ready Ready Preview, Comment Feb 28, 2026 9:34am

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the application's build performance by refactoring generateStaticParams functions in several dynamic routes. The change replaces sequential data fetching with parallel execution using Promise.all, allowing data for all conference years to be retrieved concurrently. This optimization drastically reduces the time required for static site generation, leading to faster build processes without impacting the application's functionality.

Highlights

  • Performance Optimization: Optimized generateStaticParams functions across talks/[talkId], speakers/[speakerId], and tags/[tag] dynamic pages to significantly reduce static generation build times.
  • Parallel Data Fetching: Replaced sequential asynchronous data fetching loops with Promise.all to fetch data for all available conference years in parallel, improving efficiency from O(n) to O(1) relative to the number of years.
  • Documentation: Added a new journal entry to .jules/bolt.md documenting the pattern for parallelizing build-time data fetching operations in generateStaticParams.
Changelog
  • .jules/bolt.md
    • Added a new journal entry titled "Sequential Data Fetching in Static Generation" which outlines the learning and recommended action for parallelizing data fetches in generateStaticParams.
  • app/[year]/speakers/[speakerId]/page.tsx
    • Refactored the generateStaticParams function to utilize Promise.all for parallel fetching of speaker data across all available years.
    • Replaced the previous sequential for...of loop with a map operation wrapped in Promise.all.
    • Included error handling within the Promise.all map to log warnings and return empty arrays for any failed data fetches.
  • app/[year]/tags/[tag]/page.tsx
    • Refactored the generateStaticParams function to use Promise.all for parallel fetching of talk data and subsequent tag extraction across all available years.
    • Replaced the original sequential for...of loop with a map operation executed via Promise.all.
    • Implemented error handling within the Promise.all map to log warnings and ensure empty arrays are returned for failed fetches.
  • app/[year]/talks/[talkId]/page.tsx
    • Refactored the generateStaticParams function to employ Promise.all for parallel fetching of talk data across all available years.
    • Replaced the existing sequential for...of loop with a map operation integrated with Promise.all.
    • Added error handling within the Promise.all map to log warnings and return empty arrays in case of data fetching failures.
Activity
  • PR created automatically by Jules for task [2939554868812199014] started by @anyulled.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Feb 28, 2026

Warning

Rate limit exceeded

@anyulled has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 7 minutes and 57 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between df7b516 and a5309d8.

📒 Files selected for processing (1)
  • cypress/e2e/home/home-editions.cy.ts
📝 Walkthrough

Walkthrough

Multiple pages' generateStaticParams functions were refactored to use Promise.all for concurrent data fetching across years instead of sequential loops. Per-year error handling was added. A documentation section was added to .jules/bolt.md explaining this parallel data fetching pattern for static generation.

Changes

Cohort / File(s) Summary
Documentation
.jules/bolt.md
Added new section documenting parallel data fetching in static generation using Promise.all to replace sequential awaits, with per-failure mapping guidance.
Dynamic Route Pages
app/[year]/speakers/[speakerId]/page.tsx, app/[year]/tags/[tag]/page.tsx, app/[year]/talks/[talkId]/page.tsx
Refactored generateStaticParams to fetch data concurrently across years using Promise.all instead of sequential loops. Added per-year error handling with warnings and empty array fallbacks. Results are flattened before return.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Hopping through years in parallel haste,
Promise.all speeds what once moved at snail's pace,
No sequential waits, just concurrent grace—
Each year fetches together, leaving no waste,
Static pages now blur and embrace! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: optimizing generateStaticParams with Promise.all for faster build times, which is the primary focus of all code modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bolt-optimize-static-params-2939554868812199014

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively addresses a performance bottleneck in generateStaticParams by replacing sequential data fetching loops with parallel requests using Promise.all. The change is consistently applied across the speakers, tags, and talks pages, which will improve build times. The error handling is correctly implemented to prevent single-point failures. I have one suggestion to further simplify the code in the tags page for better readability.

Comment on lines +28 to +32
const allTags = new Set<string>();

for (const talk of allTalks) {
getTagsFromTalk(talk).forEach((tag) => allTags.add(tag));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The logic for collecting all unique tags can be made more concise. You can use flatMap to get all tags from all talks and then initialize the Set directly from that array. This avoids the explicit for loop and forEach call, making the code more declarative and readable.

Suggested change
const allTags = new Set<string>();
for (const talk of allTalks) {
getTagsFromTalk(talk).forEach((tag) => allTags.add(tag));
}
const allTags = new Set<string>(allTalks.flatMap((talk) => getTagsFromTalk(talk)));

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
app/[year]/tags/[tag]/page.tsx (1)

30-32: Address static analysis warning: forEach callback returns a value.

The Biome linter flags this because Set.add() returns the Set, making the arrow function implicitly return a value. While functionally correct, consider using a block body or for...of loop to silence the warning.

🔧 Proposed fix
-        for (const talk of allTalks) {
-          getTagsFromTalk(talk).forEach((tag) => allTags.add(tag));
-        }
+        for (const talk of allTalks) {
+          for (const tag of getTagsFromTalk(talk)) {
+            allTags.add(tag);
+          }
+        }

Alternative (minimal change):

-          getTagsFromTalk(talk).forEach((tag) => allTags.add(tag));
+          getTagsFromTalk(talk).forEach((tag) => { allTags.add(tag); });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/`[year]/tags/[tag]/page.tsx around lines 30 - 32, The linter warning is
caused by the forEach arrow implicitly returning the Set because Set.add()
returns the Set; update the loop so the callback does not return a value — e.g.,
replace the forEach with an explicit block body or a for...of loop that iterates
getTagsFromTalk(talk) and calls allTags.add(tag) inside the block; target the
snippet using allTalks, getTagsFromTalk, and allTags (and Set.add) to implement
the non-returning callback.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@app/`[year]/tags/[tag]/page.tsx:
- Around line 30-32: The linter warning is caused by the forEach arrow
implicitly returning the Set because Set.add() returns the Set; update the loop
so the callback does not return a value — e.g., replace the forEach with an
explicit block body or a for...of loop that iterates getTagsFromTalk(talk) and
calls allTags.add(tag) inside the block; target the snippet using allTalks,
getTagsFromTalk, and allTags (and Set.add) to implement the non-returning
callback.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d46ccee and df7b516.

📒 Files selected for processing (4)
  • .jules/bolt.md
  • app/[year]/speakers/[speakerId]/page.tsx
  • app/[year]/tags/[tag]/page.tsx
  • app/[year]/talks/[talkId]/page.tsx

…ld times

Replaced sequential asynchronous fetching loops in `generateStaticParams`
with `Promise.all` across `app/[year]/talks/[talkId]/page.tsx`,
`app/[year]/speakers/[speakerId]/page.tsx`, and `app/[year]/tags/[tag]/page.tsx`.
This correctly parallelizes fetching for all conference years during static
generation, significantly reducing the build time bottleneck.

Also fixed a failing Cypress test in `cypress/e2e/home/home-editions.cy.ts`
which was expecting an `h5` tag that had been replaced with `.hero8-header__event-line`.

Co-authored-by: anyulled <100741+anyulled@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.

1 participant