fix: resolve the issue of occasional blank annotation and error occurrences (#4772)

#### What type of PR is this?

/kind bug

#### What this PR does / why we need it:

在获取自定义元数据时,将空白 key 与重复的 key 过滤,用于解决可能出现的额外空白元数据及报错问题。

#### How to test it?

尝试点击编辑文章 -> 设置,查看是否有额外空白元数据的出现。

由于是概率性问题,因此若本地环境未复现,则需要使用生产环境进行验证。

#### Which issue(s) this PR fixes:

Fixes #4764 

#### Does this PR introduce a user-facing change?
```release-note
解决文章设置中可能出现空白元数据的问题
```
pull/4775/head^2
Takagi 2023-10-26 15:58:15 +08:00 committed by GitHub
parent e20ab8f880
commit 2dbfbd1bd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -109,8 +109,15 @@ const handleProcessCustomAnnotations = () => {
value, value,
}; };
} }
return {
key: "",
value: "",
};
}) })
.filter((item) => item) as { key: string; value: string }[]; .filter((item) => item.key)
.filter(
(item, index, self) => self.findIndex((t) => t.key === item.key) === index
);
annotations.value = formSchemas annotations.value = formSchemas
.map((item) => { .map((item) => {