Skip to content

Commit

Permalink
Merge pull request #475 from jmysliv/master
Browse files Browse the repository at this point in the history
{beam_location}: removed updating state if unnecessary
  • Loading branch information
slovnicki authored Feb 11, 2022
2 parents d3981bc + 3123e3f commit e6d6596
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions package/lib/src/beam_location.dart
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,14 @@ abstract class BeamLocation<T extends RouteInformationSerializable>
} else {
if (routeInformation == null) {
updateState(history.last.routeInformation);
} else if (routeInformation.location == state.routeInformation.location) {
// if the new route information is the same as in the state it means
// the state changed first and notified listeners, so updating it
// will be unnecessary. Let's just add route to history with [tryPoppingHistory] set to true
addToHistory(
state.routeInformation,
beamParameters ?? const BeamParameters(),
);
} else {
updateState(routeInformation);
addToHistory(
Expand Down

0 comments on commit e6d6596

Please sign in to comment.