Skip to content

Commit

Permalink
fix(frame-router): check for new path before emitting clientNotFound …
Browse files Browse the repository at this point in the history
…event
  • Loading branch information
thomas-c-dillon committed Apr 21, 2023
1 parent 1de08f2 commit 62fa98d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/iframe-coordinator/src/elements/frame-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default class FrameRouterElement extends HTMLElement {
private _publishEmitter: InternalEventEmitter<Publication>;
private _publishExposedEmitter: EventEmitter<Publication>;
private _currentClientId: string;
private _currentPath: string;

/** @internal */
constructor() {
Expand Down Expand Up @@ -129,7 +130,7 @@ export default class FrameRouterElement extends HTMLElement {
);
}

if (clientInfo === null) {
if (clientInfo === null && this._currentPath !== newPath) {
/**
* Emit a clientNotFound event when there is no matching client.
* As a legacy behavior, a clientChanged event will also fire unless the
Expand All @@ -138,6 +139,7 @@ export default class FrameRouterElement extends HTMLElement {
this.dispatchEvent(new CustomEvent('clientNotFound'));
}

this._currentPath = newPath;
this._currentClientId = newClientId;

const newLocation = this._frameManager.setFrameLocation(
Expand Down

0 comments on commit 62fa98d

Please sign in to comment.