Skip to content

Commit

Permalink
fix: 过滤掉右手报错原则
Browse files Browse the repository at this point in the history
  • Loading branch information
syb01094648 committed Jan 12, 2024
1 parent 19f4a91 commit 921113c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/pages/components/editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ export const Editor: React.FC<EditorProps> = (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 {
Expand Down
10 changes: 6 additions & 4 deletions src/recoil/feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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);
Expand Down

0 comments on commit 921113c

Please sign in to comment.