datastake-daf 0.6.398 → 0.6.400

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.
@@ -18802,14 +18802,18 @@ const useMap$1 = ({
18802
18802
  setData(null);
18803
18803
  }
18804
18804
  }
18805
-
18806
- // if (mapRef && polylinesRef.current.length) {
18807
- // polylinesRef.current.forEach((polyline) => {
18808
- // mapRef.removeLayer(polyline);
18809
- // });
18810
- // polylinesRef.current = [];
18811
- // }
18812
- }, [allData]);
18805
+ if (mapRef && polylinesRef.current.length && type === "chain") {
18806
+ polylinesRef.current.forEach(polyline => {
18807
+ if (mapRef.hasLayer(polyline)) {
18808
+ mapRef.removeLayer(polyline);
18809
+ }
18810
+ if (polyline.remove) {
18811
+ polyline.remove();
18812
+ }
18813
+ });
18814
+ polylinesRef.current = [];
18815
+ }
18816
+ }, [allData, type]);
18813
18817
  React.useEffect(() => {
18814
18818
  if (allData) {
18815
18819
  setData(filterValidGPS$1(allData));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.398",
3
+ "version": "0.6.400",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -269,13 +269,18 @@ export const useMap = ({
269
269
  }
270
270
  }
271
271
 
272
- // if (mapRef && polylinesRef.current.length) {
273
- // polylinesRef.current.forEach((polyline) => {
274
- // mapRef.removeLayer(polyline);
275
- // });
276
- // polylinesRef.current = [];
277
- // }
278
- }, [allData]);
272
+ if (mapRef && polylinesRef.current.length && type === "chain") {
273
+ polylinesRef.current.forEach((polyline) => {
274
+ if (mapRef.hasLayer(polyline)) {
275
+ mapRef.removeLayer(polyline);
276
+ }
277
+ if (polyline.remove) {
278
+ polyline.remove();
279
+ }
280
+ });
281
+ polylinesRef.current = [];
282
+ }
283
+ }, [allData, type]);
279
284
 
280
285
  useEffect(() => {
281
286
  if (allData) {