Skip to content

Commit

Permalink
build 2.7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ErrorPro committed Jan 16, 2025
1 parent d9aa89e commit 3f786b1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/usePlacesWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ function usePlacesWidget(props) {
var inputRef = (0, _react.useRef)(null);
var event = (0, _react.useRef)(null);
var autocompleteRef = (0, _react.useRef)(null);
var observerHack = (0, _react.useRef)(null);
var languageQueryParam = language ? "&language=".concat(language) : "";
var googleMapsScriptUrl = "".concat(googleMapsScriptBaseUrl, "?libraries=").concat(libraries, "&key=").concat(apiKey).concat(languageQueryParam);
var handleLoadScript = (0, _react.useCallback)(function () {
Expand Down Expand Up @@ -103,21 +102,22 @@ function usePlacesWidget(props) {
}, []); // Autofill workaround adapted from https://stackoverflow.com/questions/29931712/chrome-autofill-covers-autocomplete-for-google-maps-api-v3/49161445#49161445

(0, _react.useEffect)(function () {
var _React$version;

// TODO find out why react 18(strict mode) hangs the page loading
if (!(_react.default !== null && _react.default !== void 0 && (_React$version = _react.default.version) !== null && _React$version !== void 0 && _React$version.startsWith("18")) && _utils.isBrowser && window.MutationObserver && inputRef.current && inputRef.current instanceof HTMLInputElement) {
observerHack.current = new MutationObserver(function () {
observerHack.current.disconnect();
if (_utils.isBrowser && window.MutationObserver && inputRef.current && inputRef.current instanceof HTMLInputElement) {
var observerHack = new MutationObserver(function () {
observerHack.disconnect();

if (inputRef.current) {
inputRef.current.autocomplete = inputAutocompleteValue;
}
});
observerHack.current.observe(inputRef.current, {
observerHack.observe(inputRef.current, {
attributes: true,
attributeFilter: ["autocomplete"]
});
return function () {
observerHack.disconnect(); // Cleanup
};
}
}, [inputAutocompleteValue]);
(0, _react.useEffect)(function () {
Expand Down

0 comments on commit 3f786b1

Please sign in to comment.