TileLayer component doesn't re-render elements on className prop change
Bug report in v1
Not sure if this is a legitimate bug, or a limitation with the way Leaflet renders elements in the DOM
Expected behavior
When the className prop updates, the component re-renders elements with values from new prop
Actual behavior
When the className prop updates, the new class does not get applied to the element in the DOM
Steps to reproduce
Here's an example:
https://codepen.io/metropolis_4/pen/bjqJNB
Click on the marker, and then click the button in the popup. Clicking this toggles the state tileLayerClass from "" to "grayscale"
This might be my bad for mis-reading the docs. I noticed the line that says
ℹ️ All other properties are passed as parameters and dynamic, they will cause the layer to redraw if they change.
I thought it was applying to all Raster Layers, but looks like maybe it only applies to WMSTileLayer?
Yes this notice is about WMSTileLayer, not the other raster layers. Only the properties documented as dynamic are expected to get updated.
In your case you'll probably want to change the element's key in order to re-render it as needed.
That makes sense, thanks for the clarification!