Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

fix(indexUtils): avoid throw an error on cleanUp multi indices #1265

Merged
merged 2 commits into from
May 24, 2018

Conversation

samouss
Copy link
Collaborator

@samouss samouss commented May 23, 2018

Summary

The PR solve an issue when we try to clean up a index that is not in the searchState. It might happen with a multi indices configuration. You can take look at this example for more context (switch on the Wikis tabs).

Now, we make sure that the index exists on the searchState before trying to remove the value. You can take a look at this commit for the fix.

I also rewrite a bit the function that handle the clean up. Instead of relying on one function we now have two function dedicated to the single / multi index. I found a bit hard to follow the code with the extended ternaries. I replaced them with early returns.

@samouss samouss requested review from vvo, bobylito and Haroenv May 23, 2018 14:17
@algobot
Copy link
Contributor

algobot commented May 23, 2018

Deploy preview for react-instantsearch ready!

Built with commit 8061b03

https://deploy-preview-1265--react-instantsearch.netlify.com

Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense!

@samouss samouss force-pushed the fix/clean-up-multi-index branch from bc0ec88 to 8061b03 Compare May 24, 2018 10:28
@samouss samouss merged commit 12f5ace into master May 24, 2018
@samouss samouss deleted the fix/clean-up-multi-index branch May 24, 2018 10:46
samouss added a commit that referenced this pull request May 28, 2018
<a name="5.1.0"></a>
# [5.1.0](v5.0.3...v5.1.0) (2018-05-28)

### Bug Fixes

* **connectInfiniteHits:** always set a value for previous page ([#1195](#1195)) ([4c218d5](4c218d5))
* **indexUtils:** avoid throw an error on cleanUp multi indices ([#1265](#1265)) ([12f5ace](12f5ace))

### Features

* **searchClient:** Add support for custom Search Clients ([#1216](#1216)) ([174cc28](174cc28))
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants