@treely/strapi-slices 8.2.6 → 8.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -4986,7 +4986,11 @@ var ProjectsMap = ({
4986
4986
  [fetchProjectsData, isBboxContained]
4987
4987
  );
4988
4988
  const addProjectsLayer = (0, import_react34.useCallback)(() => {
4989
- if (!map.current || !featureCollection || !map.current.isStyleLoaded()) {
4989
+ if (!map.current || !featureCollection) {
4990
+ return;
4991
+ }
4992
+ if (!map.current.isStyleLoaded()) {
4993
+ setTimeout(() => addProjectsLayer(), 100);
4990
4994
  return;
4991
4995
  }
4992
4996
  const filteredFeatureCollection = {
@@ -5225,7 +5229,7 @@ var ProjectsMap = ({
5225
5229
  } else {
5226
5230
  source.setData(filteredFeatureCollection);
5227
5231
  }
5228
- }, [featureCollection, locale, formatMessage]);
5232
+ }, [featureCollection, formatMessage]);
5229
5233
  (0, import_react34.useEffect)(() => {
5230
5234
  if (map.current || !mapContainer.current) return;
5231
5235
  let initialCenter;
@@ -5314,6 +5318,7 @@ var ProjectsMap = ({
5314
5318
  });
5315
5319
  const buffer = 1;
5316
5320
  const bbox = `${userLoc.lon - buffer},${userLoc.lat - buffer},${userLoc.lon + buffer},${userLoc.lat + buffer}`;
5321
+ initialBboxRef.current = bbox;
5317
5322
  fetchProjectsData(bbox);
5318
5323
  }
5319
5324
  },
@@ -5331,7 +5336,7 @@ var ProjectsMap = ({
5331
5336
  fetchProjectsData
5332
5337
  ]);
5333
5338
  (0, import_react34.useEffect)(() => {
5334
- if (isMapReady && featureCollection && map.current?.isStyleLoaded()) {
5339
+ if (isMapReady && featureCollection) {
5335
5340
  addProjectsLayer();
5336
5341
  }
5337
5342
  }, [isMapReady, featureCollection, addProjectsLayer]);