Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frontend: Publisher doesn't return the legend tool state correctly when editing a published map #81

Open
tmiosmauli opened this issue Jan 28, 2025 · 2 comments

Comments

@tmiosmauli
Copy link

If you have a published map with the legend tool activated it will be deactivated when editing the map. It is saved originally as it works in the published map but I assume its state is not returned when a user wants to edit the map.

Reproduction (e.g. https://demo.oskari.org):

  1. Publish a map that has a layer with a legend and add the legend tool in your map
  2. Enter the publisher again to edit the previously created map
    -> The legend tool will be deactivated

Fix:
Correctly set the legend tool's status according to what has been configured by the user.

@ZakarFin
Copy link
Member

Thanks for reporting!

@ZakarFin
Copy link
Member

ZakarFin commented Jan 29, 2025

Looks like this is a timing issue. If you have a layer that has a map legend on the map when you open the publisher (at least if it is one that is used in the embedded map), the publisher tool initializes correctly. The same is true if you have had that layer on the map (so it has been fully loaded from the server) before you open the publisher even if you don't have it on the map at the time publisher is opened.

So it seems this is a timing issue/race-condition with layer being added to the map which triggers a DescribeLayer call to get the full layer metadata from the server to the frontend and is async when called for the first time (hence having had the layer on map previously before entering publisher is not affected by this) and the publisher tools initialing (which is synchronous for most parts). The map legend tool in publisher is disabled if there are no maplayers on the map when it is being initialized and it might not check if it should be checked if there are no layers with map legends. Because of all this, the map legend is left unchecked if the layers of the embedded map are loaded for the first time on the session when the publisher is being opened.

Another interesting edge-case might arise if the layers that are on the embedded map had a legend at the time the embedded map was published, but when editing those layers no longer have a legend. Not sure what should happen then. The map legend toggle should be disabled since there are no layers that have legends at that time, but if the checkbox is left checked because of previous saved data the user can't then uncheck it. So I think it makes sense that the tools is unchecked if it is disabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants