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

Remove react-dom/server dependency #51

Merged
merged 1 commit into from
May 8, 2024

Conversation

bastian-src
Copy link
Contributor

ReactDOMServer has been used to compare React components. Such comparison is not necessary and therefore, the dependency can be removed.

When placing the updateResourceUtilizationView()-call right in the component, it might be called several times due to re-rendering. In order to mitigate re-setting issues, it was important that the updateResourceUtilizationView function sets the corresponding values (setResourceUtilizationPercent and setResourceUtilizationTooltipText) only once/when they actually change.
To recognize such change, the helper-function areReactElementsEqual was implemented which compares React components. This adds a dependency to react-dom/server.

The comparison helper-function, and therefore the dependency, can be removed by moving updateResourceUtilizationView() in a useEffect() that is called only once (see here).

ReactDOMServer has been used to compare React components.
Such comparison is not necessary and therefore, the dependency
can be removed.
@bastian-src bastian-src force-pushed the fix/remove_react_dom_server_dependency branch from cc40e85 to fd8cf4b Compare May 8, 2024 07:30
@Thorben-D Thorben-D merged commit 01adfa0 into main May 8, 2024
25 checks passed
@Thorben-D Thorben-D deleted the fix/remove_react_dom_server_dependency branch May 8, 2024 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants