From c45bb32d0e7bd79db6273a114633d5481ac7d99b Mon Sep 17 00:00:00 2001 From: interstellarmt <787982239@qq.com> Date: Thu, 20 Feb 2025 17:13:01 +0800 Subject: [PATCH 1/2] fix: filter out empty string ids in the legend data --- .github/workflows/build.yml | 1 - src/component/legendCategory.ts | 10 +++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 15d4cfc61f..8682adddef 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,7 +27,6 @@ jobs: - name: Update coverall if: ${{ success() }} uses: coverallsapp/github-action@master - continue-on-error: true # 暂时改动 with: github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/src/component/legendCategory.ts b/src/component/legendCategory.ts index d40fc0c7fe..94c20c038a 100644 --- a/src/component/legendCategory.ts +++ b/src/component/legendCategory.ts @@ -170,6 +170,13 @@ function inferLegendShape( return { width, height }; } +function filterEmptyIds(legendStyle) { + return { + ...legendStyle, + data: legendStyle?.data.filter((item) => item.id !== ''), + }; +} + /** * Guide Component for ordinal color scale. */ @@ -211,8 +218,9 @@ export const LegendCategory: GCC = (options) => { const { legendCategory: legendTheme = {} } = theme; + // Filter out the data items with empty string IDs in the wordCloud's data before generating the legend. const categoryStyle = adaptor( - Object.assign({}, legendTheme, legendStyle, style), + Object.assign({}, legendTheme, filterEmptyIds(legendStyle), style), ); const layoutWrapper = new LegendCategoryLayout({ From a672b0cc7913f09c4fc3379e8de6b13d8bd5a619 Mon Sep 17 00:00:00 2001 From: interstellarmt <787982239@qq.com> Date: Thu, 20 Feb 2025 17:21:12 +0800 Subject: [PATCH 2/2] fix: fix cr --- src/component/legendCategory.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/component/legendCategory.ts b/src/component/legendCategory.ts index 94c20c038a..ba76544889 100644 --- a/src/component/legendCategory.ts +++ b/src/component/legendCategory.ts @@ -173,7 +173,7 @@ function inferLegendShape( function filterEmptyIds(legendStyle) { return { ...legendStyle, - data: legendStyle?.data.filter((item) => item.id !== ''), + data: legendStyle?.data.filter((item) => item.id !== '') || [], }; }