-
Notifications
You must be signed in to change notification settings - Fork 45
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
Refactor(CVEs): Remove Unnecessary Re-render and Code Duplication #2083
base: master
Are you sure you want to change the base?
Conversation
b4896ea
to
891a7ad
Compare
I think the issue here could be more that the Modals are in a state. Refactoring this to pull them out of the state and only make them appear via a |
Reduce unnecessary re-renders
Remove code duplication
@bastilian I have looked into the option you suggested, but I am afraid it would require a lot of effort for this kind of refactor then what I thought initially... I encountered an issue in the last commit in this PR, where I try to send the handleCloseModal down the component tree, but when trying to save the changes in the modal it doesn't do anything I think what is going on is that it tries to change the businessRisk for some selected CVEs, but when the cvesList changes (to an empty Array) at the CVEs component, it rerenders all the components down the tree which causes the function to stop in the middle and it does not change anything There is an error message saying that it did not contain any selected CVEs, that is why I think this is the reason it fails... On master, we created a NEW component every time we open one of those Modals, and what I think happens is that we set the state to be an empty function (empty component) which sort of unmounts it from the component tree, but the component is kept alive until the necessary actions are dispatched and then cleared (Or there is a memory leak where the component keeps on living in the background, which is totally not good) Do you think this part of the refactor is necessary? Should we invest more time investigating it? |
This PR refactors some minor things inside the CVEs component
What does this refactor PR include?
These changes are optional, please let me know what you guys think