perf(history): intern parseHref and skip sanitize on simple paths - #8089
perf(history): intern parseHref and skip sanitize on simple paths#8089anonrig wants to merge 1 commit into
Conversation
Repeated pushes of the same href reuse the last split. Paths that start with a single slash and have no query, hash, or control characters skip the sanitize regex. Query-only and hash-only hrefs keep those markers out of the pathname.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe history package now caches parsed href components, uses a fast path for simple paths, centralizes history-state creation, and adds tests for query-only and hash-only href parsing. ChangesHistory href parsing
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This is a localized history URL parsing optimization with targeted test updates, and no actionable merge-blocking risk remains beyond normal checks and review. Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Summary
Split out of #8085 so bundle size and performance can be measured independently.
Repeated pushes of the same href reuse the last split. Paths that start with a single slash and have no query, hash, or control characters skip the sanitize regex. Open-redirect cases still go through
sanitizePath.Also treats query/hash markers at offset 0 as delimiters, so
?tab=oneand#sectionstay out of the pathname.Test plan
packages/history/tests/parseHref.test.tsSummary by CodeRabbit
Bug Fixes
Performance