-
-
Notifications
You must be signed in to change notification settings - Fork 874
Fix: resolve "Cannot read property 'filter' of undefined" error #967
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix: resolve "Cannot read property 'filter' of undefined" error #967
Conversation
if ( | ||
shouldDisplayPredefinedPlaces || | ||
|
||
const isPredefinedPlaceVisible = |
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.
I guess you can simplify this as:
const isPredefinedPlaceVisible = | |
const isPredefinedPlaceVisible = !!props?.predefinedPlacesAlwaysVisible; |
const onTimeoutFunc = () => console.warn('google places autocomplete: request timeout'); | ||
const onTimeout = props.onTimeout ?? onTimeoutFunc; | ||
const timeout = props.timeout ?? 20000; | ||
|
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.
you can change this with:
const onTimeoutFunc = () => console.warn('google places autocomplete: request timeout'); | |
const onTimeout = props.onTimeout ?? onTimeoutFunc; | |
const timeout = props.timeout ?? 20000; | |
const onTimeoutFunc = () => console.warn('google places autocomplete: request timeout'); | |
const { timeout = 20000, onTimeout = onTimeoutFunc } = props; | |
const onTimeout = () => console.warn('google places autocomplete: request timeout'); | ||
request.timeout = props.timeout ?? 20000; | ||
request.ontimeout = props.onTimeout ?? onTimeout |
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.
this will became:
const onTimeout = () => console.warn('google places autocomplete: request timeout'); | |
request.timeout = props.timeout ?? 20000; | |
request.ontimeout = props.onTimeout ?? onTimeout | |
request.timeout = timeout; | |
request.ontimeout = onTimeout; |
: text.length >= 0 | ||
: false | ||
|
||
console.log(isSearchTerm) |
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.
remove this log
@@ -327,29 +332,16 @@ export const GooglePlacesAutocomplete = forwardRef((props, ref) => { | |||
} | |||
}; | |||
|
|||
if (props.isNewPlacesAPI) { |
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.
Why are you deleting the support for PlacesAPI new version?
No description provided.