@treely/strapi-slices 8.2.5 → 8.2.6

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.js CHANGED
@@ -5066,7 +5066,6 @@ var ProjectsMap = ({
5066
5066
  const map = useRef4(null);
5067
5067
  const animationIntervalRef = useRef4(null);
5068
5068
  const [featureCollection, setFeatureCollection] = useState5(null);
5069
- const [isLoading, setIsLoading] = useState5(false);
5070
5069
  const initialBboxRef = useRef4(null);
5071
5070
  const [isMapReady, setIsMapReady] = useState5(false);
5072
5071
  const [strapiProjects, setStrapiProjects] = useState5(null);
@@ -5089,15 +5088,12 @@ var ProjectsMap = ({
5089
5088
  }, [locale, strapiProjects]);
5090
5089
  const fetchProjectsData = useCallback2(
5091
5090
  async (bbox) => {
5092
- setIsLoading(true);
5093
5091
  try {
5094
5092
  const fpmData = await getFpmProjectsByBbox_default(bbox);
5095
5093
  const mergedData = strapiProjects ? mergeProjectData_default(fpmData, strapiProjects) : fpmData;
5096
5094
  setFeatureCollection(mergedData);
5097
5095
  } catch (error) {
5098
5096
  console.error("Error fetching projects:", error);
5099
- } finally {
5100
- setIsLoading(false);
5101
5097
  }
5102
5098
  },
5103
5099
  [strapiProjects]
@@ -5379,19 +5375,17 @@ var ProjectsMap = ({
5379
5375
  center: initialCenter,
5380
5376
  zoom: initialZoom,
5381
5377
  maxZoom: MAPBOX_MAX_ZOOM,
5382
- minZoom: slice.minZoomLevel
5378
+ minZoom: slice.minZoomLevel,
5379
+ cooperativeGestures: true
5383
5380
  });
5384
5381
  map.current.addControl(new mapboxgl.NavigationControl(), "top-right");
5385
5382
  map.current.on("load", () => {
5386
- setIsMapReady(true);
5387
- });
5388
- map.current.on("moveend", () => {
5389
- if (initialBboxRef.current) {
5390
- debouncedUpdateBbox();
5383
+ if (map.current?.getLayer("road-number-shield")) {
5384
+ map.current?.setLayoutProperty("road-number-shield", "visibility", "none");
5391
5385
  }
5386
+ setIsMapReady(true);
5392
5387
  });
5393
5388
  return () => {
5394
- debouncedUpdateBbox.cancel();
5395
5389
  if (animationIntervalRef.current) {
5396
5390
  clearInterval(animationIntervalRef.current);
5397
5391
  }
@@ -5401,9 +5395,17 @@ var ProjectsMap = ({
5401
5395
  }, [
5402
5396
  slice.defaultCenterCoordinates,
5403
5397
  slice.defaultZoomLevel,
5404
- slice.minZoomLevel,
5405
- debouncedUpdateBbox
5398
+ slice.minZoomLevel
5406
5399
  ]);
5400
+ useEffect4(() => {
5401
+ if (!map.current || !isMapReady) return;
5402
+ const currentMap = map.current;
5403
+ currentMap.on("moveend", debouncedUpdateBbox);
5404
+ return () => {
5405
+ debouncedUpdateBbox.cancel();
5406
+ currentMap.off("moveend", debouncedUpdateBbox);
5407
+ };
5408
+ }, [isMapReady, debouncedUpdateBbox]);
5407
5409
  useEffect4(() => {
5408
5410
  fetchStrapiData();
5409
5411
  }, [fetchStrapiData]);
@@ -5506,8 +5508,7 @@ var ProjectsMap = ({
5506
5508
  overflow: "hidden",
5507
5509
  boxShadow: ["md", null, null, "none"]
5508
5510
  }
5509
- ),
5510
- isLoading && /* @__PURE__ */ jsx34(Box25, { children: "Loading projects..." })
5511
+ )
5511
5512
  ] })
5512
5513
  ] });
5513
5514
  };
@@ -9263,7 +9264,7 @@ var Redirect = ({ slice }) => {
9263
9264
  router.asPath,
9264
9265
  router.query
9265
9266
  );
9266
- router.replace(redirectUrl);
9267
+ window.location.replace(redirectUrl);
9267
9268
  }, [slice.url, router]);
9268
9269
  return /* @__PURE__ */ jsx61(Fragment32, {});
9269
9270
  };