You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In our codebase, we use the GooglePlacesAutocomplete component to accept user-input for Facility locations, but also to display locations for Facilities that have already been saved to our database.
We make use of the viewValue prop to be able to show our saved location
However, currentPlace is not set upon initialization of the field
Therefore, if you click into the input field, then click out, the blur function calls clear because viewValue !== currentPlace?.[viewLabel]
For new Facilities in our implementation:
If the location entered is in Canada and you click into the field then out, blur does NOT call clear because our viewValue formats the location in the same way as currentPlace[viewLabel]
If the location entered is in the US and you click into the field then out, blur DOES call clear because our viewValue formatting drops "USA" off of the location, therefore viewValue !== currentPlace[viewLabel]
If the location is anywhere else, it is hit or miss, depending on whether our viewValue location matches the currentPlace[viewLabel] value
The text was updated successfully, but these errors were encountered:
In our codebase, we use the
GooglePlacesAutocomplete
component to accept user-input for Facility locations, but also to display locations for Facilities that have already been saved to our database.For existing Facilities in our implementation:
viewValue
prop to be able to show our saved locationcurrentPlace
is not set upon initialization of the fieldblur
function callsclear
becauseviewValue
!==currentPlace?.[viewLabel]
For new Facilities in our implementation:
blur
does NOT callclear
because ourviewValue
formats the location in the same way ascurrentPlace[viewLabel]
blur
DOES callclear
because ourviewValue
formatting drops "USA" off of the location, thereforeviewValue !== currentPlace[viewLabel]
viewValue
location matches thecurrentPlace[viewLabel]
valueThe text was updated successfully, but these errors were encountered: