Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(react): fix react component update not effect #6656

Merged
merged 5 commits into from
Dec 19, 2024

Conversation

Aarebecca
Copy link
Contributor

  • 修复 React 节点更新 component 不生效的问题

#6619 导致 component 更新未触发 attributeChangedCallback 方法所致

@Aarebecca Aarebecca added the publish PR merges with this tag will perform the publication label Dec 19, 2024
Copy link

Walkthrough

此 PR 修复了 React 节点更新时组件不生效的问题,主要是由于未触发 attributeChangedCallback 方法。更新包括对测试用例的添加和对代码的调整以确保组件更新时正确调用回调。

Changes

文件 概要
packages/g6-extension-react/tests/unit/attribute-changed-callback.spec.tsx 添加了测试用例以验证 attributeChangedCallback 的调用。
packages/g6-extension-react/jest.config.js 更新了 Jest 配置以支持 TypeScript 和 JSX。
packages/g6-extension-react/src/elements/react/node.tsx 修改了 ReactNode 以确保在组件属性变化时调用 attributeChangedCallback
packages/g6/src/utils/element.ts 更新了 setAttributes 函数以支持组件属性。
packages/g6/tests/demos/case-language-tree.ts
packages/g6/tests/demos/case-unicorns-investors.ts
更新了测试用例以使用类型注解。
packages/g6-extension-3d/package.json
packages/g6-extension-react/package.json
packages/g6-ssr/package.json
packages/g6/package.json
更新了版本号。
packages/g6/src/version.ts 更新了版本号。

link: { distance: (edge) => size(edge.source) + size(edge.target) },
link: {
distance: (edge: any) => {
size(edge.source) + size(edge.target);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function distance is missing a return statement. It should return the calculated distance value. Please ensure to add return before size(edge.source) + size(edge.target);

@Aarebecca Aarebecca merged commit 59267bf into v5 Dec 19, 2024
2 checks passed
@Aarebecca Aarebecca deleted the fix/attribute-change-callback branch December 19, 2024 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
publish PR merges with this tag will perform the publication
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant