-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix: accumulate all parent context #6070
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThis PR refactors context aggregation in the router load pipeline by introducing Changes
Sequence DiagramsequenceDiagram
participant Router as Router
participant BuildCtx as buildMatchContext
participant Execute as executeBeforeLoad
participant Loader as getLoaderContext
participant Commit as loadRouteMatch Commit
Router->>BuildCtx: buildMatchContext(matches, index)
Note over BuildCtx: Merge parent matches<br/>__routeContext +<br/>__beforeLoadContext
BuildCtx-->>Router: Aggregated context
Router->>Execute: executeBeforeLoad with parent context
Execute->>BuildCtx: buildMatchContext(exclude current beforeLoad)
BuildCtx-->>Execute: Parent context only
Execute->>Execute: beforeLoad pipeline
Note over Execute: Context merged after<br/>beforeLoad resolution
Execute-->>Router: Updated context
Router->>Loader: getLoaderContext(index)
Loader->>BuildCtx: buildMatchContext(all parent + current)
BuildCtx-->>Loader: Full accumulated context
Loader-->>Router: Loader context
Router->>Commit: Commit route match
Commit->>BuildCtx: buildMatchContext(inner, index)
BuildCtx-->>Commit: Merged context for commit
Note over Commit: Context consistency<br/>across nested routes
Commit-->>Router: Committed
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (2)**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{js,ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🔇 Additional comments (5)
Comment |
|
View your CI Pipeline Execution ↗ for commit c5e478b
☁️ Nx Cloud last updated this comment at |
| includeCurrentMatch: boolean = true, | ||
| ): Record<string, unknown> => { | ||
| const context: Record<string, unknown> = { | ||
| ...(inner.router.options.context ?? {}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
undefined is spreadable, we can skip creating an object here
| ...(inner.router.options.context ?? {}), | |
| ...(inner.router.options.context), |
fixes #6068
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.