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

[Bug]: g6 5.X react custom node when collapsed node does not update rendering #6665

Open
2 of 10 tasks
yuchanghua opened this issue Dec 25, 2024 · 1 comment
Open
2 of 10 tasks
Labels
status: waiting for maintainer These issues have not yet been reviewed by a maintainer

Comments

@yuchanghua
Copy link

Describe the bug / 问题描述

g6 5.X版本 react自定义节点 收起的时候 节点没有更新渲染

Reproduction link / 复现链接

No response

Steps to Reproduce the Bug or Issue / 重现步骤

创建一个 react自定义节点 然后在节点内部 创建一个div div上面写上点击事件 当展开的时候 div 文字显示 - 收起的时候显示+

G6 Version / G6 版本

🆕 5.x

OS / 操作系统

  • macOS
  • Windows
  • Linux
  • Others / 其他

Browser / 浏览器

  • Chrome
  • Edge
  • Firefox
  • Safari (Limited support / 有限支持)
  • IE (Nonsupport / 不支持)
  • Others / 其他
@yuchanghua yuchanghua added the status: waiting for maintainer These issues have not yet been reviewed by a maintainer label Dec 25, 2024
Copy link

感谢您提供详细的信息。根据您的描述,您在使用 G6 5.x 版本时遇到了 React 自定义节点在收起时没有更新渲染的问题。为了帮助您解决这个问题,我建议您检查以下几点:

  1. 状态管理:确保在节点收起或展开时,React 组件的状态(state)正确更新。您可以使用 useState 或其他状态管理工具来管理节点的展开和收起状态。

  2. 强制更新:在某些情况下,React 组件可能不会自动重新渲染。您可以尝试使用 forceUpdate 或者通过改变组件的 key 来强制组件重新渲染。

  3. G6 的更新机制:确保在节点状态改变后,调用 G6 的 updateItemrefresh 方法来更新节点的渲染。

如果这些建议不能解决您的问题,您可以提供一个最小可复现的代码示例,这样我可以更具体地帮助您。

如果您需要进一步的帮助,请随时告诉我!

🪧 Tips For further assistance, please describe your question in the comments and @petercat-assistant to start a conversation with me.

@github-actions github-actions bot changed the title [Bug]: g6 5.X版本 react自定义节点 收起的时候 节点没有更新渲染 [Bug]: g6 5.X react custom node when collapsed node does not update rendering Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting for maintainer These issues have not yet been reviewed by a maintainer
Projects
None yet
Development

No branches or pull requests

1 participant