Skip to content
This repository was archived by the owner on Apr 10, 2026. It is now read-only.

fix: sections for docs#100

Merged
xiduzo merged 1 commit into
mainfrom
feature/fix-build
Dec 4, 2025
Merged

fix: sections for docs#100
xiduzo merged 1 commit into
mainfrom
feature/fix-build

Conversation

@xiduzo

@xiduzo xiduzo commented Dec 4, 2025

Copy link
Copy Markdown
Owner

This pull request updates the collectSections function in apps/nextjs-app/lib/sections.ts to improve how sections are accumulated during recursion. Instead of creating a new array on each recursive call, the function now accepts an optional sections parameter and accumulates results in-place, which is more efficient and avoids unnecessary array allocations.

Refactoring for efficiency and correctness:

  • Modified collectSections to take an optional sections array parameter, allowing in-place accumulation of sections during recursion, rather than creating and merging new arrays at each step.
  • Updated recursive calls within collectSections to pass the existing sections array, ensuring all discovered sections are collected in the same array.

Copilot AI review requested due to automatic review settings December 4, 2025 10:12
@vercel

vercel Bot commented Dec 4, 2025

Copy link
Copy Markdown

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

Project Deployment Preview Comments Updated (UTC)
microflow Building Building Preview Comment Dec 4, 2025 10:12am

@xiduzo xiduzo merged commit f9034c5 into main Dec 4, 2025
8 of 10 checks passed
@xiduzo xiduzo deleted the feature/fix-build branch December 4, 2025 10:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the collectSections function to improve performance by eliminating unnecessary array allocations during recursion. Instead of creating new arrays at each recursive level and spreading them into the parent array, the function now accumulates sections in-place by passing the same array reference through all recursive calls.

Key Changes

  • Modified function signature to accept an optional sections parameter with a default empty array
  • Changed recursive call from spreading returned arrays (sections.push(...collectSections(...))) to passing the accumulator array (collectSections(..., sections))

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants