-
Notifications
You must be signed in to change notification settings - Fork 5
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
fix: fix buggy member management modal state #191
Conversation
WalkthroughThe pull request modifies the Changes
Assessment against linked issues
Possibly related PRs
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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: 0
🔭 Outside diff range comments (1)
components/groups/modals/memberManagementModal.tsx (1)
Line range hint
347-353
: Enhance clipboard operation security.The clipboard operation could benefit from error handling and user feedback.
Consider adding error handling and user feedback:
onClick={e => { e.preventDefault(); - navigator.clipboard.writeText(member.address).catch(error => { - console.error('Failed to copy address:', error); - }); + navigator.clipboard.writeText(member.address) + .then(() => { + // Consider adding a toast notification or visual feedback + console.log('Address copied successfully'); + }) + .catch(error => { + console.error('Failed to copy address:', error); + // Consider adding user-friendly error feedback + }); }}
🧹 Nitpick comments (3)
components/groups/modals/memberManagementModal.tsx (3)
78-101
: Member deletion logic is well-implemented but needs type safety improvement.The member deletion logic correctly handles both new and existing members while preserving form values. However, the use of
any
type for formikRef could be improved.Consider adding proper typing for the formikRef:
-const formikRef = useRef<any>(null); +interface FormValues { + members: ExtendedMember[]; +} +const formikRef = useRef<FormikProps<FormValues>>(null);
105-125
: Consider standardizing the date format for added_at.While the member addition logic is sound, using
new Date()
directly might cause serialization issues when the data is transmitted.Consider using an ISO string format:
-added_at: new Date(), +added_at: new Date().toISOString(),
Line range hint
385-391
: Improve save button state feedback.The save button's disabled state could be more intuitive and provide better feedback.
Consider these improvements:
<button type="button" className="btn btn-md w-[calc(50%-8px)] btn-gradient text-white" onClick={() => submitFormRef.current?.()} - disabled={isSigning || !isValid || !touched} + disabled={isSigning || !isValid || (!touched && values.members.length > 0)} > - {isSigning ? 'Signing...' : 'Save'} + {isSigning ? 'Signing...' : !isValid ? 'Please fix errors' : 'Save'} </button>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
components/groups/modals/memberManagementModal.tsx
(4 hunks)
🔇 Additional comments (2)
components/groups/modals/memberManagementModal.tsx (2)
Line range hint
46-56
: LGTM! Validation schema is appropriately simplified.The validation schema correctly focuses on essential fields (address and metadata) with appropriate constraints.
240-244
: Form configuration looks good but could use better initialization.The addition of
enableReinitialize
and formikRef improves form handling.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #191 +/- ##
==========================================
- Coverage 54.61% 54.50% -0.11%
==========================================
Files 153 153
Lines 15802 15816 +14
==========================================
- Hits 8630 8621 -9
- Misses 7172 7195 +23 ☔ View full report in Codecov by Sentry. |
fixes #190
Summary by CodeRabbit
Bug Fixes
Refactor