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

fix(MultiIndex): Trigger new search when <Index> props are updated #318

Merged
merged 4 commits into from
Sep 13, 2017

Conversation

mthuret
Copy link
Contributor

@mthuret mthuret commented Sep 8, 2017

See #310

Basically until now you couldn't have dynamic <Index>.

I think I also fix a bug with MultiIndex and SSR (a way to express multi index wasn't taken into account) with this PR.

What are the big changes here: the widget manager store the whole component instead of explicitly choose at constructor time.

@algobot
Copy link
Contributor

algobot commented Sep 8, 2017

Deploy preview ready!

Built with commit 99bea20

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

@vvo vvo changed the title fix(MultiIndex): Index props we're not updated if change fix(MultiIndex): Trigger new search when <Index> props are updated Sep 11, 2017
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.

This looks good, nice feature

Copy link
Contributor

@vvo vvo left a comment

Choose a reason for hiding this comment

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

LGTM I read it all

this.unregisterWidget = widgetsManager.registerWidget({
getSearchParameters: searchParameters =>
this.getSearchParameters(searchParameters, this.props),
multiIndexContext: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we also have solved it by making multiIndexContext a function rather than a statically computed object?

Just being curious

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What this function would have return?

Copy link
Contributor

Choose a reason for hiding this comment

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

The updated indexName rather than the statically computed one. But your solution works and is more obvious: when registering a widget, you pass it as a whole

@mthuret mthuret merged commit bb11965 into master Sep 13, 2017
@mthuret mthuret deleted the fix/multi-index-props-name branch September 13, 2017 12:15
mthuret pushed a commit that referenced this pull request Sep 13, 2017
<a name="4.1.1"></a>
## [4.1.1](v4.1.0...v4.1.1) (2017-09-13)

### Bug Fixes

* **MultiIndex:** reset page to 1 when share widgets refine (#312) ([c85a7bf](c85a7bf))
* **MultiIndex:** Trigger new search when `<Index>` props are updated (#318) ([bb11965](bb11965))
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