Repository navigation
refactor: convert tag and group modals to functional components - #8232
david-yz-liu merged 2 commits into
Conversation
33cc79d to
972d469
Compare
972d469 to
f362ffd
Compare
Coverage Report for CI Build 42072763549Coverage increased (+0.005%) to 91.404%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
| if (this.props.isOpen && !prevProps.isOpen && this.props.initialGroupName) { | ||
| this.setState({groupName: this.props.initialGroupName}); | ||
| useEffect(() => { | ||
| if (isOpen && !previousIsOpen.current && initialGroupName) { |
There was a problem hiding this comment.
I think this part can be simplified to just a check of if (isOpen && initialGroupName). The useEffect should only trigger when one of these props changes, and if either changes, I think it's safe to reset the groupName state provided this condition is met.
I believe this check was originally put in place to ensure the modal was correctly populated when editing different group names (i.e., edit one group name, close the modal, edit another group name). So you could test that manually to ensure the behaviour is still correct with the change I suggested.
There was a problem hiding this comment.
Yeah in hindsight I think thats right, I removed the useRef and simplified the effect. I added/fixed tests to reflect this.
f362ffd to
61845ea
Compare
david-yz-liu
left a comment
There was a problem hiding this comment.
Nice work, @AbhirveM!
Proposed Changes
Converts
CreateTagModal,EditTagModal,CreateGroupModal, andRenameGroupModalfrom class components to functional components. The modals keep the same state, context, lifecycle, request, and callback behavior.Also strengthens the existing modal tests to cover submitted request bodies, input state resets, error handling, and restoring a group name when the rename modal reopens.
Screenshots of your changes (if applicable)
N/A. This refactor does not change the interface.
Type of Change
(Write an
Xor a brief description next to the type or types that best describe your changes.)Checklist
(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the
[ ]into an[x]in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)Before opening your pull request:
After opening your pull request:
Questions and Comments
The task description referred to
EditGroupModal. The current component is namedRenameGroupModal, so this PR converts that component as the intended fourth modal.Local verification: