Leaflet.Control.Layers.Tree icon indicating copy to clipboard operation
Leaflet.Control.Layers.Tree copied to clipboard

potential bug in selectAllCheckbox

Open cspence001 opened this issue 2 years ago • 0 comments

I have a layer control tree with selectAllCheckbox set to true for subgroups of child layers. I noticed a bug that could be in part due to my app configuration. All computable reference layers are acknowledged in the tree but the data for each is loaded in separately based on user requests. I noticed it happens that if I select a layer in the tree for data that has not yet been loaded, I get the obvious error Cannot read properties of undefined (reading 'options') - and subsequently after selecting/deselecting the selectAllCheckbox for layers that with data that had been added in and previously had not presented to be a problem that it will only compute one layer at a time - either deselecting one until none, or switching one sole layer on back and forth - with the error of Uncaught TypeError: Cannot read properties of undefined (reading 'parentNode').

Perhaps the solution is that theses children within the selectAllCheckbox subGroups need to be referenced in a separate 'overlayadd' 'overlayremove' function as a group? I do not have an issue with the selectAllCheckbox if the data is all loaded in, it only seems to occur when I have selected a ghost layer (no data underneath) and go on to select/deselect options that are available.

cspence001 avatar Apr 21 '22 23:04 cspence001