Skip to content

nodeselectchange监听事件使用useState报错 #5280

@paiap

Description

@paiap

G6 版本

4.x

问题描述

graph.on("nodeselectchange",(e) => {......})的事件监听中,使用useState来保存是否选中了节点报错(用于antd的Modal弹窗显示),提示为:TypeError:dispatch.useId is not a function 在控制台中还有错误提示:the above occured in the dialog component;以及warning:can not perform a react state update on an unmounted component........

项目:umi+qiankun+ts+hooks

重现链接

https://g6.antv.antgroup.com/zh/examples/interaction/select/#brush

重现步骤

graph.on('nodeselectchange', (e) => {
console.log(e.selectedItems, e.select);
});

在该步骤中使用useState保存e.select,用于该组件中Modal弹窗的显示与关闭

预期行为

期望能够正常弹出弹窗,

平台

  • 操作系统: Windows
  • 网页浏览器: Edge
  • G6 版本: [4.8.23]

屏幕截图或视频(可选)

1001997870286992105-IMG_20231218_112520
Uploading 1001997870286996008-IMG_20231218_112559.jpg…

1001997870286993306-IMG_20231218_112532

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions