Skip to content

Commit

Permalink
v5.0.10 fix(Polyline): fix ignoring error when uninstall maps. (#326) 3…
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Aug 23, 2023
1 parent 6be62bf commit ddef6d5
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 32 deletions.
41 changes: 22 additions & 19 deletions amap.js
Original file line number Diff line number Diff line change
Expand Up @@ -1246,14 +1246,14 @@ function useHawkEyeControl(props) {
map.addControl(instance);
setHawkEyeControl(instance);
});
return () => {
if (instance && map) {
map && map.removeControl(instance);
setHawkEyeControl(undefined);
}
};
}
}, [map]);
return () => {
if (hawkEyeControl && map) {
map && map.removeControl(hawkEyeControl);
setHawkEyeControl(undefined);
}
};
}, [map, hawkEyeControl]);
useVisiable(hawkEyeControl, visiable);
return {
hawkEyeControl,
Expand Down Expand Up @@ -1313,14 +1313,14 @@ var useInfoWindow = function useInfoWindow(props) {
if (isOpen) {
instance.open(map, position || positionCenter);
}
return () => {
if (instance) {
map && map.remove(instance);
setInfoWindow(undefined);
}
};
}
}, [map]);
return () => {
if (infoWindow) {
map && map.remove(infoWindow);
setInfoWindow(undefined);
}
};
}, [map, infoWindow]);
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
if (infoWindow) {
infoWindow.setContent(props.children ? container : other.content || '');
Expand Down Expand Up @@ -2001,12 +2001,15 @@ function usePolyline(props) {
}
return () => {
if (polyline) {
if (AMap.v) {
try {
map && map.remove(polyline);
} else {
// 暂不使用这个 API,这个不兼容 v1.4.xx,改用 map.remove API
map && map.removeLayer(polyline);
}
} catch (e) {}
// if (AMap.v) {
// map && map.remove(polyline);
// } else {
// // 暂不使用这个 API,这个不兼容 v1.4.xx,改用 map.remove API
// map && map.removeLayer(polyline);
// }
setPolyline(undefined);
}
};
Expand Down
2 changes: 1 addition & 1 deletion amap.min.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"files": {
"main.css": "/react-amap/static/css/main.bcb671be.css",
"main.js": "/react-amap/static/js/main.3cc411e1.js",
"main.js": "/react-amap/static/js/main.b009cf13.js",
"static/css/7365.bf0e21c2.chunk.css": "/react-amap/static/css/7365.bf0e21c2.chunk.css",
"static/js/7365.f4a91d19.chunk.js": "/react-amap/static/js/7365.f4a91d19.chunk.js",
"static/css/3034.bf0e21c2.chunk.css": "/react-amap/static/css/3034.bf0e21c2.chunk.css",
Expand Down Expand Up @@ -101,11 +101,11 @@
"react-vendor.js": "/react-amap/static/js/react-vendor.69b94a96.js",
"static/js/658.c11486f0.chunk.js": "/react-amap/static/js/658.c11486f0.chunk.js",
"static/js/8665.dc3cf6f2.js": "/react-amap/static/js/8665.dc3cf6f2.js",
"static/js/5775.a964eda4.chunk.js": "/react-amap/static/js/5775.a964eda4.chunk.js",
"static/js/5775.8ce265f8.chunk.js": "/react-amap/static/js/5775.8ce265f8.chunk.js",
"static/media/logo.svg": "/react-amap/static/media/logo.552138f67b47aa2ff9779e6ffc2abeed.svg",
"index.html": "/react-amap/index.html",
"main.bcb671be.css.map": "/react-amap/static/css/main.bcb671be.css.map",
"main.3cc411e1.js.map": "/react-amap/static/js/main.3cc411e1.js.map",
"main.b009cf13.js.map": "/react-amap/static/js/main.b009cf13.js.map",
"7365.bf0e21c2.chunk.css.map": "/react-amap/static/css/7365.bf0e21c2.chunk.css.map",
"7365.f4a91d19.chunk.js.map": "/react-amap/static/js/7365.f4a91d19.chunk.js.map",
"3034.bf0e21c2.chunk.css.map": "/react-amap/static/css/3034.bf0e21c2.chunk.css.map",
Expand Down Expand Up @@ -205,12 +205,12 @@
"react-vendor.69b94a96.js.map": "/react-amap/static/js/react-vendor.69b94a96.js.map",
"658.c11486f0.chunk.js.map": "/react-amap/static/js/658.c11486f0.chunk.js.map",
"8665.dc3cf6f2.js.map": "/react-amap/static/js/8665.dc3cf6f2.js.map",
"5775.a964eda4.chunk.js.map": "/react-amap/static/js/5775.a964eda4.chunk.js.map"
"5775.8ce265f8.chunk.js.map": "/react-amap/static/js/5775.8ce265f8.chunk.js.map"
},
"entrypoints": [
"static/js/react-vendor.69b94a96.js",
"static/js/8665.dc3cf6f2.js",
"static/css/main.bcb671be.css",
"static/js/main.3cc411e1.js"
"static/js/main.b009cf13.js"
]
}
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>React AMap - 高德地图 React 组件</title><meta name="keywords" content="react,component,amap,高德地图,地图,高德"/><meta name="description" content="这是一个基于 React 封装的高德地图组件,帮助你轻松的接入地图到 React 项目中。"/><link href="favicon.ico" rel="shortcut icon"><script defer="defer" src="./static/js/react-vendor.69b94a96.js"></script><script defer="defer" src="./static/js/8665.dc3cf6f2.js"></script><script defer="defer" src="./static/js/main.3cc411e1.js"></script><link href="./static/css/main.bcb671be.css" rel="stylesheet"></head><body><img src="logo.svg" style="display:none" alt="React amap logo - 高德地图 React 组件"/><div style="display:block" id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>React AMap - 高德地图 React 组件</title><meta name="keywords" content="react,component,amap,高德地图,地图,高德"/><meta name="description" content="这是一个基于 React 封装的高德地图组件,帮助你轻松的接入地图到 React 项目中。"/><link href="favicon.ico" rel="shortcut icon"><script defer="defer" src="./static/js/react-vendor.69b94a96.js"></script><script defer="defer" src="./static/js/8665.dc3cf6f2.js"></script><script defer="defer" src="./static/js/main.b009cf13.js"></script><link href="./static/css/main.bcb671be.css" rel="stylesheet"></head><body><img src="logo.svg" style="display:none" alt="React amap logo - 高德地图 React 组件"/><div style="display:block" id="root"></div></body></html>

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions static/js/5775.8ce265f8.chunk.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion static/js/5775.a964eda4.chunk.js.map

This file was deleted.

4 changes: 2 additions & 2 deletions static/js/main.3cc411e1.js → static/js/main.b009cf13.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

0 comments on commit ddef6d5

Please sign in to comment.