fix(common): prevent duplicate URL change notifications (#37459)
Prevent duplicate notifications from being emitted when multiple URL change listeners are registered using SpyLocation#onUrlChange. Use `@internal` annotation for the `_urlChangeSubscription` properties instead of the `private` access modifier. Otherwise, we get in trouble because of `SpyLocation implements Location`. PR Close #37459
This commit is contained in:

committed by
atscott

parent
0b7845964b
commit
7edb026619
@ -64,7 +64,8 @@ export class Location {
|
||||
_platformLocation: PlatformLocation;
|
||||
/** @internal */
|
||||
_urlChangeListeners: ((url: string, state: unknown) => void)[] = [];
|
||||
private _urlChangeSubscription?: SubscriptionLike;
|
||||
/** @internal */
|
||||
_urlChangeSubscription?: SubscriptionLike;
|
||||
|
||||
constructor(platformStrategy: LocationStrategy, platformLocation: PlatformLocation) {
|
||||
this._platformStrategy = platformStrategy;
|
||||
|
Reference in New Issue
Block a user