arnaudleclerc/AzureMapsControl.Components

Layer events affecting another sessions (other tabs, other users)

Closed this issue · 5 comments

Let's say we have user A and user B. And in the blazor app we have a layer in the azure map and some events in there, see a code as example:

layer.OnMouseOver += mouseEventArgs => { _navigationManager.NavigateTo("test"); };

If there's only user A, it will work fine, when the user hovers the mouse over the layer it will navigate to this test page.

But let's say User A opened the map, then User B. If User A over the mouse, it will open the page in User B tab. Why? Is this a bug or am I doing something wrong?

If someone can point what's wrong, I'll appreciate!

To Reproduce
Steps to reproduce the behavior:

  1. Create a layer
  2. Add a event to layer
  3. Add layer to map
  4. Open two tabs
  5. Invoke events from first tab opened and see the reaction in another

Expected behavior
The events should happen in the tab that invoked events

I can confirm the same behavior.

In my case, I first ran into a problem when creating two independent map components within the same Blazor page, each with a mouseover event to display a popup on the map canvas. Whichever map after being rendered first receives a mouseover event works fine, until the second map processes a mouse event. Then events on the first map stop working and vice versa.

Thanks to @phpb1997, I tried opening a map in two different browser tabs and see the same behavior.

To Reproduce:

  1. Download and run the AzureMapsControls.Components.Sample
  2. Open the HTML marker popup sample in two different browser tabs or windows.
  3. Open browser developer tools => debug console
  4. Click on the marker in the first tab to open the popup.
  5. Click on the marker in the second tab, which will fail with an exception
  6. Refresh the second tab and click on the marker. The popup should open.
  7. Click again on the marker in the first tab, which will fail.

Expected behavior:
Support for more than one map instance with event handling

@phpb1997 @markbeau First of all, sorry for the delay!

Thanks to your description, I was also able to reproduce the issue and fix it. I just published a version 1.16.0-alpha0003. Could you please check if the issue is fixed with this version and give me a feedback ?

@arnaudleclerc

Looks like it's fixed, I ran some tests and didn't find any issues anymore. Thank you so much! Have a great day!

Glad to hear! Thanks for the feedback! I just published a stable version 1.16.0 with the fix, so I will close this issue.

@arnaudleclerc
Likewise, it's looking good here too. Thanks a bunch!!!