-
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
[WEB-1907] Fix/favorite move out of folder #5305
Conversation
WalkthroughThe updates enhance the favorites management system across multiple components, incorporating improved drag-and-drop interactions for managing favorite items and folders. The integration of deletion actions for cycles, modules, views, and projects with the favorites store ensures consistent data handling and a smoother user experience, reinforcing data integrity throughout the application. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant UI
participant FavoriteStore
participant CycleStore
User->>UI: Delete Cycle
UI->>CycleStore: deleteCycle(cycleId)
CycleStore->>FavoriteStore: removeFavoriteFromStore(cycleId)
FavoriteStore-->>CycleStore: Favorite removed
CycleStore-->>UI: Cycle deleted
UI-->>User: Confirm deletion
sequenceDiagram
participant User
participant UI
participant FavoriteStore
participant ModuleStore
User->>UI: Delete Module
UI->>ModuleStore: deleteModule(moduleId)
ModuleStore->>FavoriteStore: removeFavoriteFromStore(moduleId)
FavoriteStore-->>ModuleStore: Favorite removed
ModuleStore-->>UI: Module deleted
UI-->>User: Confirm deletion
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 as PR comments)
Additionally, you can add 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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (8)
- web/core/components/workspace/sidebar/favorites/favorite-folder.tsx (6 hunks)
- web/core/components/workspace/sidebar/favorites/favorite-item.tsx (4 hunks)
- web/core/components/workspace/sidebar/favorites/favorites-menu.tsx (4 hunks)
- web/core/store/cycle.store.ts (1 hunks)
- web/core/store/favorite.store.ts (9 hunks)
- web/core/store/module.store.ts (1 hunks)
- web/core/store/project-view.store.ts (1 hunks)
- web/core/store/project/project.store.ts (1 hunks)
Additional comments not posted (24)
web/core/components/workspace/sidebar/favorites/favorite-item.tsx (5)
5-5
: LGTM! The import statement change is appropriate.The addition of
dropTargetForElements
is necessary for the new drag-and-drop functionality.
25-33
: LGTM! The new props are well-integrated.The addition of
favoriteMap
andhandleRemoveFromFavoritesFolder
props enhances the component's functionality.
108-127
: LGTM! The useEffect hook changes enhance drag-and-drop functionality.The new handlers for
onDragStart
,onDragEnter
,onDragLeave
, andonDrop
are correctly implemented.
166-166
: LGTM! The Link component change is appropriate.The new prop enhances the component's functionality.
Line range hint
187-195
: LGTM! The CustomMenu component changes are well-implemented.The new functionality enhances the component's usability.
web/core/components/workspace/sidebar/favorites/favorites-menu.tsx (4)
6-6
: LGTM! The import statement change is appropriate.The addition of
uniqBy
is necessary for ensuring unique favorites.
134-134
: LGTM! The text label change improves user experience.Changing "MY FAVORITES" to "YOUR FAVORITES" makes the interface more user-friendly.
171-171
: LGTM! The usage ofuniqBy
is correct.Processing favorites through
uniqBy
ensures that duplicates are removed, enhancing data integrity.
187-195
: LGTM! The FavoriteItem component changes are appropriate.The new prop enhances the component's functionality.
web/core/components/workspace/sidebar/favorites/favorite-folder.tsx (5)
31-31
: LGTM! The new prop is well-integrated.The addition of
handleRemoveFromFavoritesFolder
enhances the component's functionality.
35-35
: LGTM! The prop destructuring change is appropriate.The new handler is correctly destructured and used within the component.
97-97
: LGTM! TheinitialData
object change is appropriate.The addition of the
is_folder
property enhances the drag-and-drop functionality.
131-131
: LGTM! TheonDragEnter
handler change is appropriate.The new check for whether the source data is a folder enhances the drag-and-drop functionality.
146-146
: LGTM! TheonDrop
handler change is appropriate.The new payload adjustment ensures robust state management during drag-and-drop events.
web/core/store/project-view.store.ts (1)
274-274
: LGTM! But verify the method usage in the codebase.The code changes are approved.
However, ensure that all calls to
deleteView
handle the removal of favorites correctly.web/core/store/favorite.store.ts (6)
128-140
: LGTM!The changes improve error handling by capturing the initial state and restoring it if the update fails.
Line range hint
153-198
:
LGTM!The changes improve clarity, maintainability, and error handling by capturing the old parent and favorite details and providing a rollback mechanism if the operation fails.
212-212
: LGTM!The changes improve error handling by capturing the initial sequence and restoring it if the move fails.
Line range hint
221-249
:
LGTM!The changes improve error handling by capturing the parent and restoring the original state if the removal fails.
278-314
: LGTM!The changes improve error handling by capturing the initial state and restoring it if the deletion fails.
342-359
: LGTM!The new method enhances the management of favorite entities by providing a way to remove them from the store.
web/core/store/project/project.store.ts (1)
404-404
: LGTM! But verify the method usage in the codebase.The code changes are approved.
However, ensure that all calls to
deleteProject
handle the removal of favorites correctly.web/core/store/module.store.ts (1)
408-408
: LGTM! But verify the function usage in the codebase.The code changes are approved.
However, ensure that all function calls to
deleteModule
handle the removal from favorites appropriately.Verification successful
Verified: The function usage in the codebase is appropriate.
The
deleteModule
method includes the necessary call toremoveFavoriteFromStore(moduleId)
, ensuring consistency between module management and favorites tracking. The method is used in thedelete-module-modal.tsx
file, handling the deletion process correctly.
web/core/store/module.store.ts
: ThedeleteModule
method includes the call toremoveFavoriteFromStore(moduleId)
.web/core/components/modules/delete-module-modal.tsx
: ThedeleteModule
method is called appropriately.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `deleteModule` handle the removal from favorites appropriately. # Test: Search for the function usage. Expect: Proper handling of the removal from favorites. rg --type typescript -A 5 $'deleteModule'Length of output: 75
Script:
#!/bin/bash # Description: Verify all function calls to `deleteModule` handle the removal from favorites appropriately. # Test: Search for the function usage. Expect: Proper handling of the removal from favorites. rg --type ts -A 5 $'deleteModule'Length of output: 6365
web/core/store/cycle.store.ts (1)
554-554
: LGTM! But verify the function usage in the codebase.The code changes are approved.
However, ensure that all function calls to
deleteCycle
handle the removal from favorites appropriately.Verification successful
LGTM! The function usage is appropriate and the removal from favorites is handled correctly within the
deleteCycle
method.
web/core/store/cycle.store.ts
: ThedeleteCycle
method includes the call toremoveFavoriteFromStore(cycleId)
.web/core/components/cycles/delete-modal.tsx
: ThedeleteCycle
function is used, and it internally handles the removal from favorites.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `deleteCycle` handle the removal from favorites appropriately. # Test: Search for the function usage. Expect: Proper handling of the removal from favorites. rg --type typescript -A 5 $'deleteCycle'Length of output: 74
Script:
#!/bin/bash # Description: Verify all function calls to `deleteCycle` handle the removal from favorites appropriately. # Test: Search for the function usage. Expect: Proper handling of the removal from favorites. rg 'deleteCycle' --glob '*.ts' --glob '*.tsx' -A 5Length of output: 3066
web/core/components/workspace/sidebar/favorites/favorite-item.tsx
Outdated
Show resolved
Hide resolved
web/core/components/workspace/sidebar/favorites/favorite-item.tsx
Outdated
Show resolved
Hide resolved
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- web/core/components/workspace/sidebar/favorites/favorite-item.tsx (4 hunks)
Files skipped from review as they are similar to previous changes (1)
- web/core/components/workspace/sidebar/favorites/favorite-item.tsx
Summary
Users can now hover on a item to move it out of favorite
[WEB-1907]
Summary by CodeRabbit
New Features
User Interface Updates
Bug Fixes
Chores