Skip to content

Commit

Permalink
fix(FitBounds): unsubscribe after unsuccessful computation
Browse files Browse the repository at this point in the history
fixi an edge case problem where if user was using automatic fitBounds calculation suddenly switches to fitBounds object (e.g. LngLatBoundsLiteral) and then provided fitBounds by user would be overwritten by the active subscription.

fixes: #1810
  • Loading branch information
teotoplak authored Jul 16, 2020
1 parent 4e38075 commit ea471aa
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/core/directives/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,9 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy {
}
break;
default:
if (this._fitBoundsSubscription) {
this._fitBoundsSubscription.unsubscribe();
}
this._updateBounds(this.fitBounds, this.fitBoundsPadding);
}
}
Expand Down

0 comments on commit ea471aa

Please sign in to comment.