Google Maps Single Location Publish Issue

Hello, I am creating a page with a dropdown to filter to a specific database item for a google map (and other info). Everything works great in preview…the map updates to a new location based on the dropdown value. In the published version, the map doesn’t change locations when the dropdown selection changes. All the other items…address, image, etc…work fine in preview and publish.

I know issues that pop up in publish but not preview are usually related to permissions, but the dataset loaded on the page is set to read-write, and the collection is set so anyone can make changes.

//individual facilities code below
let selectedLongitude = "";
let selectedLatitude = "";
export function facilityDropdown_change(event, $w) {
    $w("#facilitiesdata").onCurrentIndexChanged((index) => {
        let itemObj = $w("#facilitiesdata").getCurrentItem();
        selectedLongitude = itemObj.longitude;
        selectedLatitude = itemObj.latitude;
        console.log(selectedLatitude)
        $w("#googleMaps1").location = {
 "latitude": selectedLongitude,
 "longitude": selectedLatitude,
        };
    })
}

Help!

Did you sync the sandbox (preview) database with Live?

Yep, its been synced.

https://www.spectrumhealthmp.nbbjsites.com/facilties

@melissaalexander08 I’m not sure, but the missing description property might be causing the problem. You could do something like this:

let itemObj = $w("#facilitiesdata").getCurrentItem();
        $w("#googleMaps1").location = {
            "latitude":  itemObj.longitude,
            "longitude": itemObj.latitude,
            "description": itemObj.city
        };

Also, it is preferable to use just one page onReady() event handler. You have 3.

I just added the description and it didnt seem to change anything in the published site.

I did the same and it didn’t help. It seems to me that there is some sort of issue with the GoogleMap component. I’m going to pass this on to QA for evaluation.

1 Like

@yisrael-wix Thanks, I also made another page with just a few elements and the code in question to see if somehow the multiple OnReady were an issue, but its the same.

https://www.spectrumhealthmp.nbbjsites.com/test

@melissaalexander08 Multiple onReady() functions should not cause a problem, however it’s not considered “best practice”. The idea is that when the page is ready, all of the code in the onReady() function is run. When you have it spread over a number of different functions, they are all combined into one blocak of code that gets run when the page is ready. The “problem” is that it makes it hard to follow and to know for sure what exactly is being run.

Got it, thanks for elaborating. If there is a bug in the googlemap component, when would we know and how long would it take to fix?

Can’t really say when. After QA evaluates, they’ll open a ticket. The dev team try their best to fix problems as quickly as possible.

1 Like

I tried this again and everything seems to be working now. Perhaps it was a temporary network problem, or an issue with Google (from Wix), but whatever… it seems OK now.

Please try this again and let me know how it goes.

It still does not work.
everything is fine in the preview mode and when published map does not works