-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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: code splitting for workspace delete modal #6581
Conversation
WalkthroughThis pull request introduces a new workspace deletion modal workflow. A new Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Modal as DeleteWorkspaceModal
participant Form as DeleteWorkspaceForm
participant Nav as Navigation/Notification
User->>Modal: Open deletion modal
Modal->>Form: Render deletion form with workspace data
User->>Form: Submit confirmation inputs
alt Valid Input
Form->>Nav: Trigger deletion, capture event, navigate, show success toast
else Invalid Input
Form->>Nav: Show error toast, capture failure event
end
Form->>Modal: Call onClose to close modal
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
🔇 Additional comments (6)
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: 2
🧹 Nitpick comments (4)
web/ce/components/workspace/delete-workspace-modal.tsx (1)
19-27
: Consider adding error boundaries for the modal.While the implementation is clean and follows good practices, consider wrapping the modal content with error boundaries to gracefully handle any rendering errors in the form component.
export const DeleteWorkspaceModal: React.FC<Props> = observer((props) => { const { isOpen, data, onClose } = props; return ( <ModalCore isOpen={isOpen} handleClose={() => onClose()} position={EModalPosition.CENTER} width={EModalWidth.XL}> + <ErrorBoundary fallback={<div>Something went wrong</div>}> <DeleteWorkspaceForm data={data} onClose={onClose} /> + </ErrorBoundary> </ModalCore> ); });web/core/components/workspace/delete-workspace-form.tsx (3)
44-44
: Consider extracting validation logic to a separate function.The validation logic in
canDelete
could be more readable if extracted to a named function.- const canDelete = watch("workspaceName") === data?.name && watch("confirmDelete") === "delete my workspace"; + const validateDeletion = (workspaceName: string, confirmPhrase: string) => { + return workspaceName === data?.name && confirmPhrase === "delete my workspace"; + }; + const canDelete = validateDeletion(watch("workspaceName"), watch("confirmDelete"));
167-169
: Enhance loading state feedback.Consider providing more detailed feedback during the deletion process.
- <Button variant="danger" size="sm" type="submit" disabled={!canDelete} loading={isSubmitting}> - {isSubmitting ? "Deleting" : "Confirm"} + <Button variant="danger" size="sm" type="submit" disabled={!canDelete || isSubmitting} loading={isSubmitting}> + {isSubmitting ? "Deleting workspace..." : "Delete workspace"} </Button>
93-172
: Consider adding keyboard shortcuts for better UX.The form could benefit from keyboard shortcuts for common actions like closing the modal with 'Esc'.
+ useEffect(() => { + const handleEscape = (e: KeyboardEvent) => { + if (e.key === "Escape") { + handleClose(); + } + }; + window.addEventListener("keydown", handleEscape); + return () => window.removeEventListener("keydown", handleEscape); + }, []); return ( <form onSubmit={handleSubmit(onSubmit)} className="flex flex-col gap-6 p-6">
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
web/ce/components/workspace/delete-workspace-modal.tsx
(1 hunks)web/ce/components/workspace/delete-workspace-section.tsx
(1 hunks)web/core/components/workspace/delete-workspace-form.tsx
(1 hunks)web/core/components/workspace/delete-workspace-modal.tsx
(0 hunks)web/core/components/workspace/index.ts
(0 hunks)web/ee/components/workspace/delete-workspace-modal.tsx
(1 hunks)
💤 Files with no reviewable changes (2)
- web/core/components/workspace/index.ts
- web/core/components/workspace/delete-workspace-modal.tsx
✅ Files skipped from review due to trivial changes (2)
- web/ee/components/workspace/delete-workspace-modal.tsx
- web/ce/components/workspace/delete-workspace-section.tsx
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Analyze (javascript)
- GitHub Check: Analyze (python)
🔇 Additional comments (1)
web/ce/components/workspace/delete-workspace-modal.tsx (1)
13-17
: LGTM! Well-defined props interface.The props interface clearly defines the required properties with appropriate types.
Description
This PR does code splitting for delete workspace modal
Summary by CodeRabbit
New Features
Refactor