fix(module-context): restore path-based initial context resolution - #5288
Merged
Conversation
…text The context-navigation plugin (#4751) removed URL-based resolution from resolveInitialContext in favor of the plugin. Consumers not yet on the plugin lost the ability to resolve initial context from the path, so restore it as a deprecated fallback composed with parent-context resolution.
🦋 Changeset detectedLatest commit: 3b570fa The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
There was a problem hiding this comment.
Pull request overview
Restores URL path-based initial context resolution while preventing the path adapter from handling non-app routes.
Changes:
- Resolves context from URL path before parent context.
- Passes configured path extraction behavior to the resolver.
- Guards path-adapter selection using app-route parsing.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
packages/modules/context/src/utils/resolve-initial-context.ts |
Composes path and parent resolution. |
packages/modules/context/src/configurator.ts |
Configures path extraction and validation. |
packages/plugins/context-navigation/src/adapters/create-path-adapter.ts |
Rejects non-app routes. |
.changeset/module-context_restore-path-based-initial-context.md |
Adds module-context patch release note. |
.changeset/plugin-context-navigation_path-adapter-app-route-guard.md |
Adds plugin patch release note. |
Suppressed comments (2)
packages/modules/context/src/utils/resolve-initial-context.ts:47
refis optional, so when the local navigation module is absent this dereferencesundefinedbefore the optional chain reachesnavigation. That makes top-level initialization fail instead of falling back to an empty path/parent context; optional-chainrefitself.
(ref as Partial<ModulesInstance<[NavigationModule]>>).navigation?.path.pathname;
packages/modules/context/src/utils/resolve-initial-context.ts:52
first()throwsEmptyErrorwhen neither the URL nor the parent provides a context, which is a normal initialization state;postInitializethen logs this as a failed resolution. Usetake(1)(and update the import) so the concatenated stream completes quietly when empty while still accepting only its first emission.
).pipe(first());
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…lveInitialContext
Noggling
force-pushed
the
fix/revert-context-initial-path-resolution
branch
from
August 13, 2026 11:30
e1c9083 to
3b570fa
Compare
Contributor
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||
odinr
approved these changes
Aug 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why is this change needed?
The context-navigation plugin (#4751) simplified
resolveInitialContextin@equinor/fusion-framework-module-contextto only resolve from the parent context, moving URL-based resolution into the plugin. Consumers that haven't adopted the plugin yet lost the ability to resolve their initial context from the URL path.What is the current behavior?
resolveInitialContext()only resolves the initial context from the parent context module; it no longer looks at the URL path at all.What is the new behavior?
resolveInitialContext(options)first attempts to resolve the context from the URL path (viaresolveContextFromPath, using the configurator'sextractContextIdFromPath), and falls back to the parent context if that yields nothing — restoring the pre-plugin behavior.ContextModuleConfigurator.createConfignow passespath.extract/path.validatederived fromextractContextIdFromPath.Also included: a fix in
@equinor/fusion-framework-plugin-context-navigation'screatePathAdapter—canHandlenow rejects URLs that don't parse as a valid app route (e.g. portal chrome), so the path adapter doesn't incorrectly claim ownership of non-app URLs.What is the intended behavior or invariant?
resolveInitialContextmust try path-based resolution first, then parent-context resolution, emitting only the first non-empty result (first()over the concatenated observables). The path adapter must only claim URLs that parse as valid app routes.Does this PR introduce a breaking change?
No.
Impact assessment:
@equinor/fusion-framework-module-contextand@equinor/fusion-framework-plugin-context-navigation(changesets included)Review guidance:
Focus on the
concat(...).pipe(first())composition inresolve-initial-context.tsand the app-route guard added tocreate-path-adapter.ts'scanHandle.Related issues
N/A
Checklist