From 95a0e2de83965accd42ae64c6655620059a1d213 Mon Sep 17 00:00:00 2001 From: Dunqing Date: Tue, 15 Aug 2023 08:39:14 +0800 Subject: [PATCH] fix(plugin-map): should filter empty data, Close T-1380 (#2447) --- packages/plugins/map/src/client/components/AMap/Block.tsx | 4 +++- .../plugins/map/src/client/components/GoogleMaps/Block.tsx | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/plugins/map/src/client/components/AMap/Block.tsx b/packages/plugins/map/src/client/components/AMap/Block.tsx index 982225607..8391a6439 100644 --- a/packages/plugins/map/src/client/components/AMap/Block.tsx +++ b/packages/plugins/map/src/client/components/AMap/Block.tsx @@ -137,7 +137,9 @@ export const AMapBlock = (props) => { return overlay; }); }) - .flat(); + .flat() + .filter(Boolean); + mapRef.current?.map?.setFitView(overlays); const events = overlays.map((o: AMap.Marker) => { diff --git a/packages/plugins/map/src/client/components/GoogleMaps/Block.tsx b/packages/plugins/map/src/client/components/GoogleMaps/Block.tsx index 8ea2bcc9c..bd9587155 100644 --- a/packages/plugins/map/src/client/components/GoogleMaps/Block.tsx +++ b/packages/plugins/map/src/client/components/GoogleMaps/Block.tsx @@ -173,7 +173,8 @@ export const GoogleMapsBlock = (props) => { return overlay; }); }) - .flat(); + .flat() + .filter(Boolean); overlaysRef.current = overlays; mapRef.current?.setFitView(overlays);