From 4f6d10814eb2acbd11082fc0c08404eb3d42688b Mon Sep 17 00:00:00 2001 From: pomelo-nwu Date: Tue, 23 Feb 2021 19:26:30 +0800 Subject: [PATCH 1/3] chore: fix dumi-theme-graphin 404 bug --- packages/dumi-theme-graphin/package.json | 4 +++- .../dumi-theme-graphin/src/components/Banner/index.tsx | 2 -- packages/dumi-theme-graphin/src/layout.tsx | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/dumi-theme-graphin/package.json b/packages/dumi-theme-graphin/package.json index ff65dcd47..c0c195400 100644 --- a/packages/dumi-theme-graphin/package.json +++ b/packages/dumi-theme-graphin/package.json @@ -19,12 +19,14 @@ "prism-react-renderer": "^1.1.1", "prismjs": "^1.21.0", "rc-tabs": "^11.7.1", + "react-i18next": "^11.8.7", + "react-slick": "^0.28.0", "react-use": "^17.1.1" }, "devDependencies": { "@testing-library/jest-dom": "^5.11.3", "@testing-library/react": "^10.4.8", - "dumi": "1.1.3", + "dumi": "1.1.5-0", "father": "^2.30.1", "global-dirs": "^2.1.0", "react-test-renderer": "^16.13.1" diff --git a/packages/dumi-theme-graphin/src/components/Banner/index.tsx b/packages/dumi-theme-graphin/src/components/Banner/index.tsx index 8fbcfda74..6f8b34660 100644 --- a/packages/dumi-theme-graphin/src/components/Banner/index.tsx +++ b/packages/dumi-theme-graphin/src/components/Banner/index.tsx @@ -6,8 +6,6 @@ import GitHubButton from 'react-github-button'; import gh from 'parse-github-url'; import classNames from 'classnames'; import { context } from 'dumi/theme'; - -import 'video-react/dist/video-react.css'; // @ts-ignore import styles from './Banner.module.less'; import Notification, { NotificationProps } from './Notification'; diff --git a/packages/dumi-theme-graphin/src/layout.tsx b/packages/dumi-theme-graphin/src/layout.tsx index 8bf6610e3..17b116a3b 100644 --- a/packages/dumi-theme-graphin/src/layout.tsx +++ b/packages/dumi-theme-graphin/src/layout.tsx @@ -107,8 +107,8 @@ const Layout: React.FC = ({ children, location }) => { locale, } = Context; - const { meta } = processRedirect(Context, location); - + const { meta, isDirect } = processRedirect(Context, location); + console.log('Context', Context, 'calculate meta', meta); const { url: repoUrl, branch, platform } = repository; const [menuCollapsed, setMenuCollapsed] = useState(true); const isSiteMode = mode === 'site'; @@ -130,8 +130,8 @@ const Layout: React.FC = ({ children, location }) => { const updatedTime: any = new Date(meta.updatedTime).toLocaleString([], { hour12: false }); const repoPlatform = { github: 'GitHub', gitlab: 'GitLab' }[(repoUrl || '').match(/(github|gitlab)/)?.[1] || 'nothing'] || platform; - - if (isEmpty(meta)) { + // 等dumi最新版发布后解决路由匹配问题 + if (isEmpty(meta) && !isDirect) { return (
Date: Tue, 23 Feb 2021 19:28:01 +0800 Subject: [PATCH 2/3] fix: replace deepMix with cloneDeep --- packages/graphin/package.json | 3 ++- packages/graphin/src/Graphin.tsx | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/graphin/package.json b/packages/graphin/package.json index a6b4ea4ff..2d6988d42 100644 --- a/packages/graphin/package.json +++ b/packages/graphin/package.json @@ -49,7 +49,8 @@ "dependencies": { "@antv/g-canvas": "^0.5.1", "@antv/g6": "4.1.11", - "@antv/util": "^2.0.10" + "@antv/util": "^2.0.10", + "lodash-es": "^4.17.21" }, "peerDependencies": { "react": "^16.x", diff --git a/packages/graphin/src/Graphin.tsx b/packages/graphin/src/Graphin.tsx index 764d574ef..839708247 100644 --- a/packages/graphin/src/Graphin.tsx +++ b/packages/graphin/src/Graphin.tsx @@ -2,11 +2,12 @@ import React, { ErrorInfo } from 'react'; // todo ,G6@unpack版本将规范类型的输出 import G6, { Graph as IGraph, GraphOptions, GraphData, TreeGraphData } from '@antv/g6'; import { deepMix } from '@antv/util'; - /** utils */ // import shallowEqual from './utils/shallowEqual'; import deepEqual from './utils/deepEqual'; +import cloneDeep from 'lodash-es/cloneDeep'; + import './index.less'; /** Context */ @@ -158,7 +159,7 @@ class Graphin extends React.PureComponent { if ((data as GraphinTreeData).children) { this.isTree = true; } - this.data = deepMix({}, data); + this.data = cloneDeep(data); }; initGraphInstance = () => { From 87a2d9b55f1912d3aa7f414cc79975df85d3a549 Mon Sep 17 00:00:00 2001 From: pomelo-nwu Date: Tue, 23 Feb 2021 19:32:05 +0800 Subject: [PATCH 3/3] chore:update version to 2.0.1 --- packages/graphin-components/package.json | 2 +- packages/graphin/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/graphin-components/package.json b/packages/graphin-components/package.json index 981190222..ffca46aa8 100644 --- a/packages/graphin-components/package.json +++ b/packages/graphin-components/package.json @@ -54,7 +54,7 @@ "peerDependencies": { "react": "^16.x", "react-dom": "^16.x", - "@antv/graphin": "2.0.0" + "@antv/graphin": "^2.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/graphin/package.json b/packages/graphin/package.json index 2d6988d42..5b773d333 100644 --- a/packages/graphin/package.json +++ b/packages/graphin/package.json @@ -1,6 +1,6 @@ { "name": "@antv/graphin", - "version": "2.0.0", + "version": "2.0.1", "description": "the react toolkit for graph analysis based on g6", "main": "lib/index.js", "module": "es/index.js",