Skip to content

Commit

Permalink
fix(Geosuggest): GeoCode fixtures if no location is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
Caerostris committed Jun 1, 2016
1 parent 307edba commit 67ec4e5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/Geosuggest.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ class Geosuggest extends React.Component {
if (!skipSuggest(suggest) && suggest.label.match(regex)) {
fixturesSearched++;

suggest.placeId = suggest.label;
suggests.push(suggest);
}
});
Expand Down Expand Up @@ -270,6 +269,7 @@ class Geosuggest extends React.Component {

if (suggest.location) {
this.setState({ignoreBlur: false});
suggest.placeId = suggest.placeId || suggest.label;
this.props.onSuggestSelect(suggest);
return;
}
Expand All @@ -292,6 +292,7 @@ class Geosuggest extends React.Component {
var gmaps = results[0],
location = gmaps.geometry.location;

suggest.placeId = suggest.placeId || gmaps.place_id;
suggest.gmaps = gmaps;
suggest.location = {
lat: location.lat(),
Expand Down
4 changes: 2 additions & 2 deletions src/suggest-list.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ export default ({
);

return <ul className={classes}>
{suggests.map(suggest => {
{suggests.map((suggest, index) => {
const isActive = activeSuggest &&
suggest.placeId === activeSuggest.placeId;

return <SuggestItem key={suggest.placeId}
return <SuggestItem key={index}
className={suggest.className}
suggest={suggest}
isActive={isActive}
Expand Down

0 comments on commit 67ec4e5

Please sign in to comment.