Updating token for vector layer?
Describe the problem
I'm making an app where there's a possibility of the token timing out during use (I'd like to change that but out of my control). Having looked through the code the token looks baked into the urls sent to the maplibre layers?
Describe the proposed solution
It would be great if there was a function (if possible, if it's not fair enough) to update the token used by a particular layer. The calling app would handle when to do this.
Alternatives considered
No response
Additional Information
No response
This is pretty timely since we will probably be introducing something like this soon for some upcoming features.
For now you can access the private _glMap object https://github.com/Esri/esri-leaflet-vector/blob/master/src/MaplibreGLLayer.js#L169C10-L169C16 which returns the Map object and then use getSource() and VectorTileSource.setUrl() to update the token.
The whole chain would probably look something like this:
const layer = L.esri.Vector.vectorTileLayer("ITEM_ID", {
token: "...",
}).addTo(map);
layer._glMap.getSource("esri").setTileUrl("tile url with new token")
Thanks Patrick!