Skip to content

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ashar-aala
Copy link

No description provided.

if (
shouldDisplayPredefinedPlaces ||

const isPredefinedPlaceVisible =

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:

Suggested change
const isPredefinedPlaceVisible =
const isPredefinedPlaceVisible = !!props?.predefinedPlacesAlwaysVisible;

Comment on lines +75 to +78
const onTimeoutFunc = () => console.warn('google places autocomplete: request timeout');
const onTimeout = props.onTimeout ?? onTimeoutFunc;
const timeout = props.timeout ?? 20000;

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:

Suggested change
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;

Comment on lines +285 to +287
const onTimeout = () => console.warn('google places autocomplete: request timeout');
request.timeout = props.timeout ?? 20000;
request.ontimeout = props.onTimeout ?? onTimeout

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will became:

Suggested change
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)

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) {

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants