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

feat(geo): add connector [PART-1] #1171

Merged
merged 19 commits into from
Jun 21, 2018
Merged

feat(geo): add connector [PART-1] #1171

merged 19 commits into from
Jun 21, 2018

Conversation

samouss
Copy link
Collaborator

@samouss samouss commented Apr 18, 2018

This is the first part of the work for the GeoSearch widget. The second part will be the widget itself implemented (with Google Maps) with this connector. Most of the API is fixed but I will update the PR if something is missing during the widget implementation.

At the end in this version we don't support all the APIs that InstantSearch support. It's because with the current implementation of React InstantSearch it's very complicated to update the internal state of the widget from the outside. So we only manage the state of the search in the connector.

Issue:

The part that might change is the one where we compute the current position. This position is used (mainly) to move the map to the correct bounds when we don't have results. It might change because with the current implementation we can only read the position from the path aroundLatLng in the searchState. It's perfect for a custom widget (like Places for example), the widget needs to write the position at this path (an example will be built in Storybook). But when the position is set by Configure we need to look at a different path configure.aroundLatLng. We have some solutions:

  • allow to configure the path where we want to find the value as prop
  • search at multiple paths stop on the first match aroundLatLngconfigure.aroundLatLng
  • implement the position, radius & precision as props of the connector (like InstantSearch). This solution remove the needs to look at different paths, we can only keep the top level one

Update:

  • I updated the PR to be able to override the shouldComponentUpdate hook of createConnector from the connector definition. To enable a full customisation we should be able to re-render the content of the marker. But the createConnector prevent this update based on his props & state. Now we can bypass this limitation by implementing the shouldUpdate function on the connector.

@algobot
Copy link
Contributor

algobot commented Apr 18, 2018

Deploy preview for react-instantsearch ready!

Built with commit 33e22ca

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

Copy link
Contributor

@bobylito bobylito left a comment

Choose a reason for hiding this comment

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

Some content comments. Will add more later :)

@samouss samouss force-pushed the feat/geo-part-one branch 3 times, most recently from 1e1201d to 23769fc Compare June 19, 2018 16:25
* feat(geo): add refine on interaction [PART-3] (#1192)

* feat(geo): add Redo component [PART-4] (#1201)

* feat(geo): add Control component [PART-5] (#1205)

* feat(geo): refactor & external update [PART-6] (#1207)

* feat(geo): custom Marker [PART-7] (#1214)

* feat(geo): add Marker & HTMLMarker interactions [PART-8] (#1227)

* feat(geo): add stories [PART-9] (#1236)

* feat(geo): add docs [PART-10] (#1289)
@samouss samouss merged commit 16e288a into master Jun 21, 2018
@samouss samouss deleted the feat/geo-part-one branch June 21, 2018 06:50
samouss added a commit that referenced this pull request Jul 4, 2018
<a name="5.2.0"></a>
# [5.2.0](v5.2.0-beta.2...v5.2.0) (2018-07-04)

### Bug Fixes

* **translatable:** avoid create a new function on every render ([#1383](#1383)) ([1285b3b](1285b3b))

### Features

* **core:** export translatable ([#1351](#1351)) ([6d5a89d](6d5a89d))
* **maps:** add connector & widget ([#1171](#1171)) ([16e288a](16e288a)), closes [#1189](#1189) [#1192](#1192) [#1201](#1201) [#1205](#1205) [#1207](#1207) [#1214](#1214) [#1227](#1227) [#1236](#1236) [#1289](#1289)
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.

None yet

4 participants