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

graph gets re-rendered when nodeTypes/edgeTypes change #1620

Closed
chrtze opened this issue Oct 28, 2021 · 1 comment
Closed

graph gets re-rendered when nodeTypes/edgeTypes change #1620

chrtze opened this issue Oct 28, 2021 · 1 comment
Assignees
Projects
Milestone

Comments

@chrtze
Copy link
Member

chrtze commented Oct 28, 2021

When the nodeTypes object is created inside the render function of a component without using useMemo, the graph gets re-rendered infinitely. Maybe we can check if the keys of the nodeTypes object change or show a warning when something like this happens.

const InfiniteRender = () => {
  const nodeTypes = {
    foo: Bar
  };

  const onNodesChange = () => {
    ...
  }


  return <ReactFlow onNodesChange={onNodesChange} nodeTypes={nodeTypes} />
}
@chrtze chrtze added this to the v10 milestone Oct 28, 2021
@chrtze chrtze added the v10 label Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
v10
Awaiting triage
Development

No branches or pull requests

3 participants
@moklick @chrtze and others