From 817a818495153d8d88778b2240b29d2f19805e01 Mon Sep 17 00:00:00 2001 From: yunji Date: Fri, 6 Dec 2024 19:06:05 +0800 Subject: [PATCH 1/3] fix: theme undefined with antd@4 --- src/Text/utils/useAntdDarkAlgorithm.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Text/utils/useAntdDarkAlgorithm.ts b/src/Text/utils/useAntdDarkAlgorithm.ts index 06252e3..f7f258d 100644 --- a/src/Text/utils/useAntdDarkAlgorithm.ts +++ b/src/Text/utils/useAntdDarkAlgorithm.ts @@ -2,10 +2,11 @@ import { ConfigProvider, theme as antdTheme } from 'antd'; import { isArray } from 'lodash'; import { useContext } from 'react'; -const { darkAlgorithm } = antdTheme; - /** 判断是否运用了 antd dark algorithm */ export const useAntdDarkAlgorithm = () => { + // 放到函数内部,避免用户使用 antd@4,theme 变量不存在情况!!! + const darkAlgorithm = antdTheme?.darkAlgorithm; + const config = useContext(ConfigProvider.ConfigContext); const currentAlgorithm = config.theme?.algorithm; From 8fc779bc36d441c3ae86246aba5840b7909c11b8 Mon Sep 17 00:00:00 2001 From: lvisei Date: Fri, 6 Dec 2024 19:08:23 +0800 Subject: [PATCH 2/3] Create silent-buckets-grab.md --- .changeset/silent-buckets-grab.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/silent-buckets-grab.md diff --git a/.changeset/silent-buckets-grab.md b/.changeset/silent-buckets-grab.md new file mode 100644 index 0000000..4a34efe --- /dev/null +++ b/.changeset/silent-buckets-grab.md @@ -0,0 +1,5 @@ +--- +'@antv/gpt-vis': patch +--- + +fix: theme undefined with antd@4 From 0444df9185ccf84a99f373ddd7e13f81adca30f6 Mon Sep 17 00:00:00 2001 From: yunji Date: Fri, 6 Dec 2024 19:50:55 +0800 Subject: [PATCH 3/3] chore: format --- .changeset/silent-buckets-grab.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/silent-buckets-grab.md b/.changeset/silent-buckets-grab.md index 4a34efe..94f9e8f 100644 --- a/.changeset/silent-buckets-grab.md +++ b/.changeset/silent-buckets-grab.md @@ -2,4 +2,4 @@ '@antv/gpt-vis': patch --- -fix: theme undefined with antd@4 +fix: theme undefined with antd@4