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

poc: connectGeoSeach with createConnector #1073

Closed
wants to merge 17 commits into from
Closed

Conversation

samouss
Copy link
Collaborator

@samouss samouss commented Mar 12, 2018

This PR is a POC, it's not intended to be merged.

I played a bit around the connector API in order to handle a "'stateful" instance. This lets us the possibility to implement the UI logic directly in the connector.

  • initialUiState: You can define a new property on the connector declaration. This property takes a function that returns the initial UI state for the connector. The function takes props as argument.

  • setUiState: You can access this function in every method of the connector. It's wrapper around the setState function that lets you update only the uiState. It means that now we can trigger new render on the fly to respond to users interactions.

It's definitely not a final API, but it can fit pretty easily with the current implementation without rewriting everything. Happy to have your feedback!

You can play with the GeoSearch example on Storybook.

Note: the test are failing it's completely normal.

@algobot
Copy link
Contributor

algobot commented Mar 12, 2018

Deploy preview for react-instantsearch ready!

Built with commit 8d41d23

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

};

onIdle = () => {
const { isRefineOnMapMove } = this.props;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don’t think this needs the is Prefix

uiState: initialUiState,
props: this.getProvidedProps({
...props,
...initialUiState,
Copy link
Collaborator Author

@samouss samouss Mar 14, 2018

Choose a reason for hiding this comment

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

I don't like that, we should not merge that in the props. We should pass the uiState as an argument to the connector definition (getProvidedProps, ...) but at the same time they already have a lots of arguments.

@samouss samouss force-pushed the poc/connect-geo-search branch from 83c53c1 to 29937a6 Compare April 3, 2018 10:39
@samouss
Copy link
Collaborator Author

samouss commented Apr 24, 2018

Closing in favour of #1171.

@samouss samouss closed this Apr 24, 2018
@samouss samouss deleted the poc/connect-geo-search branch April 24, 2018 19:43
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.

3 participants