Map: wherever I click it opens a popup

541
5
Jump to solution
03-26-2024 02:12 AM
fb1
by
New Contributor III

Hello, everyone,

I have a problem in the map that I cannot understand,
I recently upgraded to version 4.29 and had to download all the modules locally,
since then in the map I get that wherever I click a popup opens, whereas before it only opened when I clicked on a single element of a featureLayer, and of course when I click outside an element it opens an empty popup

fb1_0-1711444206032.png

Is there anything I can do to avoid this behaviour?
or at least that it doesn't open popups if they are empty

thanks in advance

0 Kudos
2 Solutions

Accepted Solutions
KyleONeill
New Contributor II

I had the same issue. I wrote this snippet to fix the bug for now -- hopefully it won't be needed in a later release.

I'm not using this fix in production yet and is specific to the popup event loop my map uses (which is a pretty standard one), so definitely test it in your application.

 

       reactiveUtils.watch(
            () => view.popup?.viewModel?.active,
            (active) => {
                if (active && !view.popup.selectedFeature) {
                    view.closePopup();
                }
            }
        );

 

View solution in original post

fb1
by
New Contributor III

i discovered that with my version of angular (15) and consequently also the libraries were not up to date, so i had various problems after having put all the modules locally. i updated angular to version 17, and fixed all the bugs apart from the only error i saw that is known is the zoom's button not working

View solution in original post

0 Kudos
5 Replies
ReneRubalcava
Frequent Contributor II

Could you provide a codepen, github repo, stackblitz, or codesandbox to repro case to look at. It's possible there is data on the map with empty popup template, or some logic in the app to open the popup on click, but not way to tell otherwise.

0 Kudos
KyleONeill
New Contributor II

I had the same issue. I wrote this snippet to fix the bug for now -- hopefully it won't be needed in a later release.

I'm not using this fix in production yet and is specific to the popup event loop my map uses (which is a pretty standard one), so definitely test it in your application.

 

       reactiveUtils.watch(
            () => view.popup?.viewModel?.active,
            (active) => {
                if (active && !view.popup.selectedFeature) {
                    view.closePopup();
                }
            }
        );

 

BetulPercinel
New Contributor

Thank you for the resolution. It saved my day 🙂 

I added the code after mapview initialized. 

0 Kudos
fb1
by
New Contributor III

i discovered that with my version of angular (15) and consequently also the libraries were not up to date, so i had various problems after having put all the modules locally. i updated angular to version 17, and fixed all the bugs apart from the only error i saw that is known is the zoom's button not working

0 Kudos
fb1
by
New Contributor III

mainly the zone.js library was giving problems

0 Kudos