Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(RoutingManager): remove dead code #3631

Merged
merged 4 commits into from
Apr 1, 2019

Conversation

samouss
Copy link
Contributor

@samouss samouss commented Mar 28, 2019

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 the routing system it's not the case. We compare a plain object with an instance of SearchParameters, 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 the URLSync was not able to restore a full state from the URL. With the routing system it's not the case. We compute the SearchParameters directly from the current helper.state which means that it already contains the "configuration" part (which is disjunctiveFacets, etc... crafted at getConfiguration).

  • 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 to algoliasearchHelper is replaced with SearchParameters.make because we only use the state of the helper. You can take a look at the constructor implementation, the replacement call is equivalent.

@samouss samouss requested a review from a team March 28, 2019 11:58
@algobot
Copy link
Contributor

algobot commented Mar 28, 2019

Deploy preview for instantsearchjs ready!

Built with commit 9f4a459

https://deploy-preview-3631--instantsearchjs.netlify.com

src/lib/RoutingManager.js Outdated Show resolved Hide resolved
@samouss samouss force-pushed the fix/routing-dead-condition branch from d760cb6 to 30d3b72 Compare April 1, 2019 11:13
@samouss samouss merged commit 0739658 into develop Apr 1, 2019
@samouss samouss deleted the fix/routing-dead-condition branch April 1, 2019 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants