@treely/strapi-slices 8.2.6 → 8.3.0

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
@@ -7,7 +7,7 @@ import { setupCache } from "axios-cache-interceptor";
7
7
 
8
8
  // src/constants/strapi.ts
9
9
  var STRAPI_URI = process.env.NEXT_PUBLIC_STRAPI_URI || "http://127.0.0.1:1337";
10
- var STRAPI_DEFAULT_PAGE_SIZE = "100";
10
+ var STRAPI_DEFAULT_PAGE_SIZE = "1000";
11
11
  var STRAPI_DEFAULT_POPULATE_DEPTH = "6";
12
12
  var STRAPI_FALLBACK_LOCALE = "en";
13
13
 
@@ -128,7 +128,7 @@ var getStrapiProjects_default = getStrapiProjects;
128
128
  var getPortfolioProjects = async (locale = "en", preview = false) => {
129
129
  const cache2 = preview ? false : void 0;
130
130
  const [{ data: fpmProjects }, strapiProjects] = await Promise.all([
131
- fpmClient_default.get("/public/projects", { cache: cache2 }),
131
+ fpmClient_default.get("/public/projects?limit=1000", { cache: cache2 }),
132
132
  getStrapiProjects_default(locale, STRAPI_DEFAULT_POPULATE_DEPTH, preview)
133
133
  ]);
134
134
  return fpmProjects.map((fpmProject) => {
@@ -5111,7 +5111,11 @@ var ProjectsMap = ({
5111
5111
  [fetchProjectsData, isBboxContained]
5112
5112
  );
5113
5113
  const addProjectsLayer = useCallback2(() => {
5114
- if (!map.current || !featureCollection || !map.current.isStyleLoaded()) {
5114
+ if (!map.current || !featureCollection) {
5115
+ return;
5116
+ }
5117
+ if (!map.current.isStyleLoaded()) {
5118
+ setTimeout(() => addProjectsLayer(), 100);
5115
5119
  return;
5116
5120
  }
5117
5121
  const filteredFeatureCollection = {
@@ -5350,7 +5354,7 @@ var ProjectsMap = ({
5350
5354
  } else {
5351
5355
  source.setData(filteredFeatureCollection);
5352
5356
  }
5353
- }, [featureCollection, locale, formatMessage]);
5357
+ }, [featureCollection, formatMessage]);
5354
5358
  useEffect4(() => {
5355
5359
  if (map.current || !mapContainer.current) return;
5356
5360
  let initialCenter;
@@ -5439,6 +5443,7 @@ var ProjectsMap = ({
5439
5443
  });
5440
5444
  const buffer = 1;
5441
5445
  const bbox = `${userLoc.lon - buffer},${userLoc.lat - buffer},${userLoc.lon + buffer},${userLoc.lat + buffer}`;
5446
+ initialBboxRef.current = bbox;
5442
5447
  fetchProjectsData(bbox);
5443
5448
  }
5444
5449
  },
@@ -5456,7 +5461,7 @@ var ProjectsMap = ({
5456
5461
  fetchProjectsData
5457
5462
  ]);
5458
5463
  useEffect4(() => {
5459
- if (isMapReady && featureCollection && map.current?.isStyleLoaded()) {
5464
+ if (isMapReady && featureCollection) {
5460
5465
  addProjectsLayer();
5461
5466
  }
5462
5467
  }, [isMapReady, featureCollection, addProjectsLayer]);