-
Notifications
You must be signed in to change notification settings - Fork 13k
refactor: standardize CreateDiscussion modal using GenericModal #38334
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
base: develop
Are you sure you want to change the base?
refactor: standardize CreateDiscussion modal using GenericModal #38334
Conversation
|
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
WalkthroughReplaces the deprecated Modal in CreateDiscussion with GenericModal, adds a Changes
Sequence Diagram(s)(Skipped — changes are primarily a refactor and do not introduce a new multi-component control flow requiring visualization.) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 6 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name=".changeset/add-emoji-keyword-search.md">
<violation number="1" location=".changeset/add-emoji-keyword-search.md:5">
P1: Unrelated changeset: declares emoji keyword search feature and minor meteor bump not present in this PR</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 4 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/ui-client/src/components/Modal/GenericModal/GenericModal.tsx">
<violation number="1" location="packages/ui-client/src/components/Modal/GenericModal/GenericModal.tsx:157">
P2: Submit path with `wrapperFunction` is treated as dismiss because `dismissedRef` is never cleared, leading to `onDismiss` firing after submit</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
… and add confirmLoading prop
e1c615e to
298ce8e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx`:
- Around line 112-123: FieldLabel's htmlFor is using parentRoomId but when
defaultParentRoom is rendered the DefaultParentRoomField isn't receiving that id
so the label-input association is broken; update the Controller rendering of
DefaultParentRoomField (inside the parentRoom Controller) to forward the
parentRoomId (or an aria-labelledby that references FieldLabel) as a prop and
ensure DefaultParentRoomField applies that prop to its internal input element so
the FieldLabel htmlFor matches the actual input id.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx`:
- Around line 217-223: The aria-describedby currently references
`${firstMessageId}-hint` even when `encrypted` is true and that hint element
isn't rendered; update the TextAreaInput in CreateDiscussion so aria-describedby
only includes the hint IDs that are actually rendered (i.e., include
`${firstMessageId}-hint` when not encrypted and include
`${firstMessageId}-encrypted-hint` when encrypted), apply the same conditional
logic to the other TextAreaInput usage noted (lines 227-231), and keep this
change within the CreateDiscussion component around the TextAreaInput props to
avoid broken ARIA references.
- Around line 161-167: The aria-describedby on the TextInput references
`${discussionNameId}-hint` but no hint element is rendered; either remove
`${discussionNameId}-hint` from the aria-describedby string or add a
visible/assistive hint element with that id next to the TextInput so the
reference is valid. Locate the TextInput usage (discussionNameId, field,
errors.name) and either (a) remove `${discussionNameId}-hint` from
aria-describedby leaving `${discussionNameId}-error` only, or (b) render a hint
element (e.g., a small help text element with id `${discussionNameId}-hint`)
adjacent to the input so assistive tech can resolve the reference.
packages/ui-client/src/components/Modal/GenericModal/GenericModal.tsx
Outdated
Show resolved
Hide resolved
apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx
Outdated
Show resolved
Hide resolved
apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx
Outdated
Show resolved
Hide resolved
apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx
Outdated
Show resolved
Hide resolved
apps/meteor/client/components/CreateDiscussion/DefaultParentRoomField.tsx
Outdated
Show resolved
Hide resolved
- Update to warning variant with null icon - Remove unused modalId variable - Fix broken ARIA references for accessibility Addresses feedback from @dougfabris in PR RocketChat#38334
|
@dougfabris All review comments addressed:
Ready for re-review! |
|
@NAME-ASHWANIYADAV Please make sure to check the lint issues and there some requests I did still pending |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 3 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/ui-client/src/components/Modal/GenericModal/GenericModal.tsx">
<violation number="1" location="packages/ui-client/src/components/Modal/GenericModal/GenericModal.tsx:157">
P2: Wrapper function confirm no longer clears dismissedRef, so modal cleanup may fire onDismiss/onCancel after a successful submit.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
sorry my this pr takes a lot of your effort i will make sure to improve myself and contribute more efficient by getting more familiar with the code base |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #38334 +/- ##
========================================
Coverage 70.77% 70.78%
========================================
Files 3159 3159
Lines 109401 109402 +1
Branches 19675 19672 -3
========================================
+ Hits 77428 77436 +8
+ Misses 29944 29934 -10
- Partials 2029 2032 +3
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Not worries @NAME-ASHWANIYADAV this was a very nice work. |
dougfabris
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the work here!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 2 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/ui-client/src/components/Modal/GenericModal/GenericModal.tsx">
<violation number="1" location="packages/ui-client/src/components/Modal/GenericModal/GenericModal.tsx:156">
P2: Confirm button now always renders; for non-form modals this creates duplicate “Ok” buttons or a non-functional confirm button when `wrapperFunction` is absent.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
packages/ui-client/src/components/Modal/GenericModal/GenericModal.tsx
Outdated
Show resolved
Hide resolved
|
why are you doing this? I approved your PR and you added more not related stuff? |
|
Sorry about that @dougfabris— my mistake 🙏 I acted on a bot comment without realizing the PR was already approved. If you prefer, I can: Please let me know how you’d like me to proceed. |
904fdc8 to
1f33626
Compare
dougfabris
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't worry, everything is ok now!
|
This PR currently has a merge conflict. Please resolve this and then re-add the |
Description
This PR refactors the
CreateDiscussioncomponent to utilize the standardizedGenericModalcomponent from@rocket.chat/ui-client, replacing the manualcomposition of
Modal,ModalHeader,ModalContent, andModalFooter.This change addresses existing technical debt identified by a TODO comment in
CreateDiscussion.tsxand aligns the component with the codebase’s modern UIpatterns.
Additionally, this PR enhances
GenericModalby introducing aconfirmLoadingprop, enabling loading states on the confirmation button duringasync operations such as creating a discussion.
Related issues
Changes proposed
CreateDiscussion.tsxto replace direct usage ofModalsub-components with
GenericModal.GenericModal.tsxby adding aconfirmLoadingprop toGenericModalPropsand forwarding it to the primary action button.Modal,ModalHeader,ModalTitle,ModalClose,ModalContent,ModalFooter).ReactElementreturn type to improve typeinference and resolve linting issues.
Verification steps
+menu).(new
confirmLoadingfunctionality).as expected.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.