palerdot/react-d3-speedometer

Force Rerender happens on any state change, irregardless of direct prop changes

Closed this issue · 1 comments

Like the title says, force render is making my component rerender if other states change after the initial component is rendered, even if the parent component state is changed, the child component where the speedometer is affected.

If this is intended behavior, could you point me in the right direction of modifying the Speedometer source code to rerender the maxValue prop on change as well? That would resolve my issue.

forceRender prop is for re-rendering the whole component when any of the prop changes ... In your case if you have given forceRender={true} then the maxValue will automatically be updated to new value and the speedometer gauge will be re-drawn completely ... so if you want to update only maxValue you should control your component and pass static unchanged values except maxValue (or any other prop you wish to change) ...

I'm closing this issue since it seems like an issue with how you are organizing your components ... If you have a reproducible code sandbox link please share it here for better context ...