Files
editor/patches/mapbox-gl-inspect+1.3.1.patch
Harel M 5f54dd0ccf Temp fix using patch-package for maplibre-inspect issue (#885)
This is a temporary fix for:
 - #871

The fix is using `patch-package` to fix the part of the code that is
causing the issue, I believe.
Initial tests shows that this is fixing the issue, I hope it is not
introducing other issues.
A proper fix and also using the maplibre package will be done once a
repo is migrated as can be expected after the following PR is resolved:
- https://github.com/maplibre/maplibre/issues/359
2024-03-09 23:03:23 +02:00

19 lines
758 B
Diff

diff --git a/node_modules/mapbox-gl-inspect/lib/MapboxInspect.js b/node_modules/mapbox-gl-inspect/lib/MapboxInspect.js
index ea9bf07..3e7ab38 100644
--- a/node_modules/mapbox-gl-inspect/lib/MapboxInspect.js
+++ b/node_modules/mapbox-gl-inspect/lib/MapboxInspect.js
@@ -159,7 +159,12 @@ MapboxInspect.prototype._onSourceChange = function () {
});
if (!isEqual(previousSources, sources) && Object.keys(sources).length > 0) {
- this.render();
+ setTimeout(() => {
+ // The calling method is being called when the sources are being updated.
+ // render might call setStyle, which is not a good idea while updating the source.
+ // So, we are delaying the render to the next event loop.
+ this.render();
+ }, 100);
}
};