-
Notifications
You must be signed in to change notification settings - Fork 386
feat(geo): add refine on interaction [PART-3] #1192
Conversation
Deploy preview for react-instantsearch ready! Built with commit f12a24d https://deploy-preview-1192--react-instantsearch.netlify.com |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some naming suggestions mostly
@@ -23,6 +24,10 @@ class GoogleMaps extends Component { | |||
}), | |||
}; | |||
|
|||
isUserInteraction = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure what these flags mean
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The map can be updated by the user or programmatically. But the events are triggered in both cases. When we trigger programmatic events we need to "lock" the map to avoid to trigger event listeners.
@@ -66,23 +73,89 @@ class GoogleMaps extends Component { | |||
position, | |||
} = this.props; | |||
|
|||
const { isMapAlreadyRender } = this.state; | |||
|
|||
if (!isMapAlreadyRender || this.isPendingRefine) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isMapRendered
); | ||
}; | ||
|
||
lockUserInteration(functionThatAlterTheMapPosition) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
functionThatAltersTheMapPosition
stories/GeoSearch.stories.js
Outdated
{google => ( | ||
<GeoSearch google={google}> | ||
{({ hits }) => ( | ||
<Fragment> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you can return an array, why is the Fragment still needed 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It not needed, but it's more convenient because the array still need to have key
on their elements. I can even render inside a <div>
it doesn't matter much.
2562ba4
to
3f58bc8
Compare
a3edc66
to
0af5667
Compare
3f58bc8
to
7daecb9
Compare
0af5667
to
3dc3e71
Compare
7daecb9
to
c6644f2
Compare
3dc3e71
to
f0cec76
Compare
c6644f2
to
d0be94c
Compare
f0cec76
to
05f6e6d
Compare
d0be94c
to
7a85119
Compare
Not sure that this is accurate given that you then list components and their behaviour. |
05f6e6d
to
5d66ea9
Compare
7a85119
to
a85b3df
Compare
5d66ea9
to
479cdc1
Compare
a85b3df
to
678c09e
Compare
125f026
to
7dfc345
Compare
678c09e
to
6083a6c
Compare
* 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)
* 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)
* feat(geo): add simple GoogleMaps widget [PART-2] (#1189) * 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)
<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)
Summary
This is the third part of the GeoSearch widget. It implement the basic support of refine on map interaction. Every time the map move, we schedule a refinement on the next "idle" event. You can't control the behaviour of the refinement. It will comes after. I skip the support for the padding on refine because I didn't find a proper way to do it. Can be implement later.
This PR does not include new components:
<Provider>
: expose the refine function to his render props<GeoSearch>
: provide the refine function to<GoogleMaps>
<GoogleMaps>
: setup the listeners on the map and bind the call to refine with the map boundsResult
You can use the widget in Storybook.