question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nodes do not re-render when prop gets updated

See original GitHub issue

Hi, I’m trying to change the definition of the nodes passed to the GraphView each time a determined event occurs (in my case, when a value on a drop down list change). However, the nodes involved in the update do not immediately change; to trigger a new rendering I have to hover over every node that I need to update.

Is there a way to force the rendering of updated nodes on a determined event?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sillle14commented, Jul 14, 2020

I also needed to force rerender nodes, and was able to solve the problem using a ref and directly calling asyncRenderNode as needed. Is this use case common enough that it would be worth adding this method to the docs in the Imperative API section?

1reaction
riccardoloccicommented, Jan 23, 2020

Unfortunately creating a new array each time I need an update did not work in my case.

However, thanks to the reference that you provided, I solved my issue by (ab)using the value forceReRender at line 274 (https://github.com/uber/react-digraph/blob/master/src/components/graph-view.js#L274): every time I need a new render, I just pass a different value to layoutEngineType.

Thank you

Read more comments on GitHub >

github_iconTop Results From Across the Web

React: why child component doesn't update when prop ...
Update the child to have the attribute 'key' equal to the name. The component will re-render every time the key changes.
Read more >
How and when to force a React component to re-render
React automatically re-renders components, but what happens when a component is not updating as expected? Find out what you can do here.
Read more >
When does React re-render components?
There are two common reasons why React might not update a component even though its props have changed: The props weren't updated correctly...
Read more >
5 Ways to Avoid React Component Re-Renderings
1. Memoization using useMemo() and UseCallback() Hooks ... Memoization enables your code to re-render components only if there's a change in the props....
Read more >
Re-Render React Component When Its Props Changes
The redux-store is updated properly, but the child component doesn't re-render. It's normally not the responsibility of the Child to fill the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found