mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #718] [MERGED] perf: optimize resolveParentParams lookups #796
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#796
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/718
Author: @NathanDrake2406
Created: 3/30/2026
Status: ✅ Merged
Merged: 3/30/2026
Merged by: @james-elicx
Base:
main← Head:perf/resolve-parent-params📝 Commits (5)
3531955test: add direct unit tests for resolveParentParams4210d7cperf: optimize resolveParentParams lookupsb0c62a3test: add edge case tests for resolveParentParams4e307c1refactor: simplify resolveParentParams internals73a246frefactor: address bonk review nits in resolveParentParams📊 Changes
2 files changed (+182 additions, -41 deletions)
View changed files
📝
packages/vinext/src/build/prerender.ts(+40 -40)📝
tests/prerender.test.ts(+142 -1)📄 Description
Summary
allRoutes.find())patternPartsfromAppRouteinstead of re-splitting the pattern string on every callslice().some()allocation)slice(0, i+1).join("/")per dynamic segmentParentSegment.paramsfield (allocated but never read)StaticParamsMaptype for reuse across production code and testsThese are in-memory micro-optimizations (~1ms savings on a 500-route site). The expensive HTTP fetches are already deduplicated by
staticParamsCache. The wins are small but the code is cleaner — fewer allocations, O(1) lookups, and no dead fields.Partially addresses #563 (ticks the
resolveParentParamslookups checkbox).Test plan
resolveParentParamscovering: no parents, missing pagePath, missing generateStaticParams, single parent, two-level nesting, static segments between dynamic parents, fully static routes, single-segment dynamic routes, catch-all child segmentstests/prerender.test.tsintegration suite passes (including nested/shop/[category]/[item]top-down params)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.