refactor(RoutingManager): remove dead code #3631
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR removes dead code inside the
RoutingManager
. Here is the changes:L66-72: It was previously used inside the
URLSync
implementation to avoid useless search + render. Inside the previous implementation, it was working fine because both values were objects (getState
with a filter function returns a plain object). With therouting
system it's not the case. We compare a plain object with an instance ofSearchParameters
, even with the same parameters the two values are different. It means that with the new implementation the condition never worked. I removed the condition because we never had an issue related to performance in that part of the code since the release of the feature.L167-172: It was previously used inside the
URLSync
implementation to provide the full state to the callback. It was required because theURLSync
was not able to restore a full state from the URL. With therouting
system it's not the case. We compute theSearchParameters
directly from the currenthelper.state
which means that it already contains the "configuration" part (which isdisjunctiveFacets
, etc... crafted atgetConfiguration
).L26-37: We got rid of the usage of
this.originalConfig
inside the manager at the two previous steps which means that we can drop it completely. The call toalgoliasearchHelper
is replaced withSearchParameters.make
because we only use thestate
of the helper. You can take a look at the constructor implementation, the replacement call is equivalent.