jumpinjackie / mapguide-react-layout

An openlayers-based modern map viewer for MapGuide
https://jumpinjackie.github.io/mapguide-react-layout/
MIT License
62 stars 13 forks source link

Legend group / layer check state not updated if layer toggled via dispatch #1458

Closed Jamo181 closed 1 year ago

Jamo181 commented 1 year ago

Describe the bug Using the viewer API to toggle a map group / layer doesn't update the legend to reflect. On further investigation if I toggle a layer in the same manner then open / close the folder it is in it is ticked as expected....

What is your environment?

  1. MapGuide Installation
    • Version: 4.0.0.10004
    • OS: Windows 11
    • WebTier configuration (IIS/Apache): IIS
  2. mapguide-react-layout version: 0.14.7

To Reproduce Steps to reproduce the behavior:

  1. Go to mapguide-react-layout Sidebar Application in browser
  2. Open a console
  3. execute the following actions where Services is a valid group name:
var grp = getViewer()._state.map.Group.filter(g=>g.Name == "Services")[0];
var setVisibleAction = MapGuide.Actions.Legend.setGroupVisibility("MainMap", {id:grp.ObjectId,value:true});
getViewer().dispatch(setVisibleAction);

Expected behavior

  1. Defined Group is turned on
  2. Legend folder/layer tick reflects groups new state
  3. Map is refreshed to reflect new state

Screenshots/Browser DevTools output Does your browser devtools (F12) show any console/network errors at the time the problem occurs or is there any visual indicators of the problem? No errors

Include relevant output/screenshots here: N/A

jumpinjackie commented 1 year ago

Thank you for this very informative bug report. This fix will be in 0.14.8