Untitled

                Never    
    const inputListener = fromEvent(props.inputRef.current, 'input')
      .pipe(debounceTime(500))
      .subscribe(e => {
        setList(null);
        const fieldValue = autocompleteInput.value;
        if (fieldValue) {
          openPredictionList();
          autocomplete.getPlacePredictions(
            {
              input: fieldValue,
              types: ['geocode'],
              componentRestrictions: props.componentRestrictions
            },
            (predictions, status) => {
              if (status !== window.google.maps.places.PlacesServiceStatus.OK) {
                closePredictionList();
                if (status !== 'ZERO_RESULTS') {
                  console.error(
                    'Problem happened with google.maps.places.AutocompleteService',
                    status,
                    fieldValue
                  );
                }
                return;
              }

              from(predictions)
                .pipe(
                  map(value =>
                    from(
                      new Promise((resolve, reject) => {
                        placeService.getDetails(
                          {
                            placeId: value.place_id
                          },
                          (place, status) => {
                            if (
                              status !==
                              window.google.maps.places.PlacesServiceStatus.OK
                            ) {
                              reject({
                                place_id: value.place_id,
                                status
                              });
                            }
                            resolve({
                              ...value,
                              ...place
                            });
                          }
                        );
                      })
                    ).pipe(
                      retryWhen(errors =>
                        errors.pipe(
                          delay(5000),
                          take(1)
                        )
                      )
                    )
                  ),
                  toArray(),
                  mergeMap(p => forkJoin(...p)),
                  catchError(e => {
                    console.error(e);
                  })
                )
                .subscribe(data => {
                  setList(data.filter(props.filterFunc));
                });
            }
          );
        } else {
          closePredictionList();
        }
      });

Raw Text