alvarcarto / alvarcarto-designer

Alvar Carto map designer and order app
http://design.alvarcarto.com
3 stars 1 forks source link

Error when searching a city #16

Closed kimmobrunfeldt closed 7 years ago

kimmobrunfeldt commented 7 years ago
Unhandled rejection TypeError: Cannot read property 'long_name' of undefined
    at findCityFromGoogleObject (webpack:///./src/components/GeoSearch.js?:159:5)
    at googleObjectToResult (webpack:///./src/components/GeoSearch.js?:135:11)
    at eval (webpack:///./src/components/GeoSearch.js?:103:30)
From previous event:
    at Object._onChange (webpack:///./src/components/GeoSearch.js?:102:67)
    at Object.setValue (webpack:///./~/react-select/lib/Select.js?:654:14)
    at Object.eval (webpack:///./~/react-select/lib/Select.js?:675:12)
    at CallbackQueue.notifyAll (webpack:///./~/react-dom/lib/CallbackQueue.js?:76:22)
    at ReactUpdatesFlushTransaction.close (webpack:///./~/react-dom/lib/ReactUpdates.js?:59:24)
    at ReactUpdatesFlushTransaction.closeAll (webpack:///./~/react-dom/lib/Transaction.js?:206:25)
    at ReactUpdatesFlushTransaction.perform (webpack:///./~/react-dom/lib/Transaction.js?:153:16)
    at ReactUpdatesFlushTransaction.perform (webpack:///./~/react-dom/lib/ReactUpdates.js?:89:32)
    at Object.flushBatchedUpdates (webpack:///./~/react-dom/lib/ReactUpdates.js?:172:19)
    at ReactDefaultBatchingStrategyTransaction.closeAll (webpack:///./~/react-dom/lib/Transaction.js?:206:25)
    at ReactDefaultBatchingStrategyTransaction.perform (webpack:///./~/react-dom/lib/Transaction.js?:153:16)
    at Object.batchedUpdates (webpack:///./~/react-dom/lib/ReactDefaultBatchingStrategy.js?:62:26)
    at Object.batchedUpdates (webpack:///./~/react-dom/lib/ReactUpdates.js?:97:27)
    at dispatchEvent (webpack:///./~/react-dom/lib/ReactEventListener.js?:147:20)
screenshot 2017-01-15 00 05 04
kimmobrunfeldt commented 7 years ago

Fixed. Now behaves like this:

// If locality type is not found, try to iterate through all different
// administrative_area_level_x starting from the largest number, which is
// the most precise(smallest) area. This may end up with having e.g. state
// name as the City but that is OK compromise.

And if everything fails, we are setting 'UNKNOWN CITY' or 'UNKNOWN COUNTRY' as the label.