From 921113c63da31864759ab87c6b83b2cdc51a1cb4 Mon Sep 17 00:00:00 2001 From: syb01094648 Date: Fri, 12 Jan 2024 11:30:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=BF=87=E6=BB=A4=E6=8E=89=E5=8F=B3?= =?UTF-8?q?=E6=89=8B=E6=8A=A5=E9=94=99=E5=8E=9F=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/components/editor.tsx | 6 +++++- src/recoil/feature.ts | 10 ++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/pages/components/editor.tsx b/src/pages/components/editor.tsx index 01f5eab..5d66184 100644 --- a/src/pages/components/editor.tsx +++ b/src/pages/components/editor.tsx @@ -57,7 +57,11 @@ export const Editor: React.FC = (props) => { )) as string | null; if (newEditorText && scene && !props.features) { try { - const errors = hint(JSON.parse(newEditorText)); + const errors = hint(JSON.parse(newEditorText)).filter( + (item: { message: string }) => + item.message !== + 'Polygons and MultiPolygons should follow the right-hand rule', + ); if (errors.length > 0) { message.error(t('import_btn.file_upload.qingJianChaShuJu')); } else { diff --git a/src/recoil/feature.ts b/src/recoil/feature.ts index 9667c37..19db9d7 100644 --- a/src/recoil/feature.ts +++ b/src/recoil/feature.ts @@ -73,7 +73,11 @@ export default function useFeature() { let newFeatures: Feature[] = []; if (editorText || value) { try { - const errors = hint(JSON.parse(value ?? editorText)); + const errors = hint(JSON.parse(value ?? editorText)).filter( + (item: { message: string }) => + item.message !== + 'Polygons and MultiPolygons should follow the right-hand rule', + ); if (errors.length > 0) { message.warning(t('recoil.feature.shuJuJiaZaiYou')); } else { @@ -84,9 +88,7 @@ export default function useFeature() { setSavedText(value ?? editorText); setFeatures(newFeatures as IFeatures); } - } catch (error) { - message.warning(t('recoil.feature.shuJuJiaZaiYou')); - } + } catch (error) {} } else { setEditorText(emptyFeatures); setSavedText(emptyFeatures);