Skip to content

Commit e1c9083

Browse files
committed
fix(plugin-context-navigation): guard path adapter against non-app routes
canHandle now rejects URLs that don't parse as a valid app route, so the path adapter doesn't claim ownership of portal-chrome/non-app URLs.
1 parent 6c67126 commit e1c9083

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@equinor/fusion-framework-plugin-context-navigation": patch
3+
---
4+
5+
Fix `createPathAdapter` matching on non-app routes. `canHandle` now rejects a URL when `currentURL.pathname` does not parse as a valid app route (e.g. portal chrome), preventing the path adapter from incorrectly claiming ownership of URLs where there is no app route to encode context into.

packages/plugins/context-navigation/src/adapters/create-path-adapter.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,17 @@ export function createPathAdapter(): ContextNavigationAdapter {
4141
* Accepts apps with explicit `'path'` strategy or no declared strategy
4242
* (the path adapter serves as the system-wide default fallback).
4343
*/
44-
canHandle({ appContext, routingStrategy }: AdapterResolutionContext): boolean {
44+
canHandle({ appContext, routingStrategy, currentURL }: AdapterResolutionContext): boolean {
4545
// Custom generators mean the app owns its URL shape — the custom adapter handles it, not us
4646
if (hasCustomContextGenerators(appContext)) {
4747
return false;
4848
}
4949

50+
// Not an app route (e.g. portal chrome) — nothing for this adapter to encode context into
51+
if (!parseAppRoute(currentURL.pathname)) {
52+
return false;
53+
}
54+
5055
const declared = routingStrategy;
5156
// App explicitly opted into path-segment routing — take ownership
5257
if (declared === 'path') {

0 commit comments

Comments
 (0)