perf(history): avoid generating unused location keys - #8349
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesHistory state preservation
Estimated code review effort: 2 (Simple) | ~10 minutes Change: Refactor Merge Risk: ⚪ Minimal · up to The supplied change preserves provided history state and adds coverage for both supplied and generated state behavior, with no remaining merge-blocking risk identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
|
View your CI Pipeline Execution ↗ for commit 9eeb94f
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version Preview3 package(s) bumped directly, 21 bumped as dependents. 🟩 Patch bumps
|
Bundle Size Benchmarks
The following scenarios have bundle-size changes compared with the baseline:
Current gzip tracks all emitted client JS chunks. Initial gzip tracks only the entry/import graph. Trend sparkline is historical current gzip ending with this PR measurement; lower is better. |
There was a problem hiding this comment.
Important
At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.
Nx Cloud has identified a possible root cause for your failed CI:
We determined these E2E failures are environment-related and not caused by this PR. The parseHref change is a functionally identical performance optimization, and neither failing project is in the set of projects touched by the diff. The React test shows explicit ECONNRESET network errors from the test server, and the Solid test is a router-idle timeout — both pointing to infrastructure instability rather than a logic regression.
No code changes were suggested for this issue.
Trigger a rerun:
🎓 Learn more about Self-Healing CI on nx.dev
|
This looks very mergeable. while you're at it, can we also do this? falsy values are spread-able in JS function assignKeyAndIndex(index: number, state: HistoryState | undefined) {
- if (!state) {
- state = {}
- }
const key = createRandomKey()
return {
...state,
key, // TODO: Remove in v2 - use __TSR_key instead
__TSR_key: key,
[stateIndexKey]: index,
} as ParsedHistoryState
} |
done |
…dIndex Spreading undefined is a no-op, so the guard was dead weight.
3302f6b to
a2f58a3
Compare
🎯 Changes
Generate a fallback history key in
parseHrefonly when no state is supplied. Parsing a location with existing state no longer creates and discards a random key.Performance
Local Node.js 24.12.0 microbenchmark comparing
6494e75362with9eeb94f921. Nine alternating baseline/candidate rounds per case, with 100,000 warmup calls and 2,000,000 timed calls per sample. The URL is/items/123?tab=details#top; times below are medians.parseHrefwith existing stateparseHrefwithout stateExisting-state parsing removes one discarded key-generation operation per call. These are isolated runtime results, not an end-to-end navigation speedup or a retained-heap measurement.
✅ Checklist
🚀 Release Impact
Summary by CodeRabbit