Skip to content

refactor: convert tag and group modals to functional components - #8232

Merged
david-yz-liu merged 2 commits into
MarkUsProject:masterfrom
AbhirveM:refactor-tag-group-modal-components
Nov 6, 2026
Merged

david-yz-liu merged 2 commits into
MarkUsProject:masterfrom
AbhirveM:refactor-tag-group-modal-components

Conversation

@AbhirveM

@AbhirveM AbhirveM commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Proposed Changes

Converts CreateTagModal, EditTagModal, CreateGroupModal, and RenameGroupModal from 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 X or a brief description next to the type or types that best describe your changes.)

Type Applies?
🚨 Breaking change (fix or feature that would cause existing functionality to change)
✨ New feature (non-breaking change that adds functionality)
🐛 Bug fix (non-breaking change that fixes an issue)
🎨 User interface change (change to user interface; provide screenshots)
♻️ Refactoring (internal change to codebase, without changing functionality) X
🚦 Test update (change that only adds or modifies tests)
📦 Dependency update (change that updates a dependency)
📖 Documentation update (change that updates documentation)
🔧 Internal (change that only affects developers or continuous integration)

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:

  • I have performed a self-review of my changes.
    • Check that all changed files included in this pull request are intentional changes.
    • Check that all changes are relevant to the purpose of this pull request, as described above.
  • I have added tests for my changes, if applicable.
    • This is required for all bug fixes and new features.
  • [N/A] I have updated the project documentation, if applicable.
    • This is required for new features.
  • [N/A] If this is my first contribution, I have added myself to the list of contributors.

After opening your pull request:

  • I have updated the project Changelog (this is required for all changes).
  • I have verified that the pre-commit.ci checks have passed.
  • I have verified that the CI tests have passed.
  • I have reviewed the test coverage changes reported by Coveralls.
  • I have requested a review from a project maintainer.

Questions and Comments

The task description referred to EditGroupModal. The current component is named RenameGroupModal, so this PR converts that component as the intended fourth modal.

Local verification:

  • Four focused Jest suites: 16 tests passed.
  • Full Jest suite: 50 suites passed, 522 tests passed, 28 skipped.
  • Production webpack build passed.
  • Pre-commit hooks for all changed files passed.

@AbhirveM
AbhirveM force-pushed the refactor-tag-group-modal-components branch from 33cc79d to 972d469 Compare October 23, 2026 17:18
@AbhirveM
AbhirveM marked this pull request as ready for review October 23, 2026 17:18
@AbhirveM
AbhirveM force-pushed the refactor-tag-group-modal-components branch from 972d469 to f362ffd Compare October 23, 2026 17:19
@coveralls

coveralls commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 42072763549

Coverage increased (+0.005%) to 91.404%

Details

  • Coverage increased (+0.005%) from the base build.
  • Patch coverage: 43 of 43 lines across 4 files are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 54331
Covered Lines: 50737
Line Coverage: 93.38%
Relevant Branches: 2626
Covered Branches: 1324
Branch Coverage: 50.42%
Branches in Coverage %: Yes
Coverage Strength: 129.72 hits per line

💛 - Coveralls

@AbhirveM
AbhirveM requested a review from david-yz-liu October 23, 2026 17:37
if (this.props.isOpen && !prevProps.isOpen && this.props.initialGroupName) {
this.setState({groupName: this.props.initialGroupName});
useEffect(() => {
if (isOpen && !previousIsOpen.current && initialGroupName) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah in hindsight I think thats right, I removed the useRef and simplified the effect. I added/fixed tests to reflect this.

@AbhirveM
AbhirveM force-pushed the refactor-tag-group-modal-components branch from f362ffd to 61845ea Compare November 5, 2026 17:15

@david-yz-liu david-yz-liu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, @AbhirveM!

@david-yz-liu
david-yz-liu merged commit 74fe5c2 into MarkUsProject:master Nov 6, 2026
9 checks passed
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.

3 participants