Skip to content

🎥 Make videos programmatically with React

Remove comments added by map lifecycle fix

Igor Samokhovets2efa10fd9b8c
diff --git a/packages/maptiler/src/MapRegion.tsx b/packages/maptiler/src/MapRegion.tsx
index 1ad62bda10..8de422ea18 100644
--- a/packages/maptiler/src/MapRegion.tsx
+++ b/packages/maptiler/src/MapRegion.tsx
@@ -146,7 +146,6 @@ const MapRegionDrawing = ({
]);
useLayoutEffect(() => {
- // Reconnected effects can still capture the map destroyed while hidden.
if (!map || !map.style) {
return;
}
@@ -290,7 +289,6 @@ const MapRegionDrawing = ({
}
return () => {
- // The viewport's layout cleanup may already have removed the map.
if (!map.style) {
return;
}
diff --git a/packages/maptiler/src/MapRoute.tsx b/packages/maptiler/src/MapRoute.tsx
index 77413aa566..3e785b88ce 100644
--- a/packages/maptiler/src/MapRoute.tsx
+++ b/packages/maptiler/src/MapRoute.tsx
@@ -118,7 +118,6 @@ const MapRouteDrawing = ({
]);
useLayoutEffect(() => {
- // Reconnected effects can still capture the map destroyed while hidden.
if (!map || !map.style) {
return;
}
@@ -229,7 +228,6 @@ const MapRouteDrawing = ({
}
return () => {
- // The viewport's layout cleanup may already have removed the map.
if (!map.style) {
return;
}
diff --git a/packages/maptiler/src/MapViewport.tsx b/packages/maptiler/src/MapViewport.tsx
index 8fb10104ba..d77af6e3d8 100644
--- a/packages/maptiler/src/MapViewport.tsx
+++ b/packages/maptiler/src/MapViewport.tsx
@@ -311,8 +311,6 @@ const MapViewportContent: FC<MapViewportContentProps> = ({
administrativeBorders: initialOptions.administrativeBorders,
showLabels: initialOptions.showLabels,
};
- // SDK 4.0.2's telemetry timer outlives map.remove() and reads the removed
- // style after two seconds. The SDK only offers a global telemetry opt-out.
maptilerConfig.telemetry = false;
// Keep MapTiler's logo and attribution visible:
// https://docs.maptiler.com/guides/map-design/attribution/remove-attribution/
@@ -373,8 +371,6 @@ const MapViewportContent: FC<MapViewportContentProps> = ({
return () => {
cancelled = true;
- // Activity tears down effects while retaining state. Never publish the
- // removed map when these effects reconnect on becoming visible again.
setLoadedMap(null);
mapInstance.remove();
mapRef.current = null;
diff --git a/packages/maptiler/src/use-map-premounting.ts b/packages/maptiler/src/use-map-premounting.ts
index 3bca5ef1a4..38bdb06509 100644
--- a/packages/maptiler/src/use-map-premounting.ts
+++ b/packages/maptiler/src/use-map-premounting.ts
@@ -14,7 +14,6 @@ export const useMapPremounting = (getLayerIds: () => string[]) => {
layerIdsRef.current = getLayerIds;
const applyPremountVisibility = useCallback(() => {
- // Passive effects may flush after the viewport's layout cleanup.
if (!map || !map.style) {
return;
}