-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat: Folder move order by name #4313
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -242,7 +242,6 @@ const handleDrop = (draggingNode: any, dropNode: any, dropType: string, ev: Drag | |
| emit('refreshTree') | ||
| }) | ||
| .catch(() => { | ||
| MsgError(t('components.folder.requiredMessage')) | ||
| emit('refreshTree') | ||
| }) | ||
| } | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are no serious issues with the provided code. However, there is a minor suggestion to improve readability: const handleDrop = (draggingNode: any, dropNode: any, dropType: string, ev: DragEvent) => {
try {
emit('refreshTree');
} catch (error) {
MsgError(t('components.folder.requiredMessage'));
emit('refreshTree');
}
};In this version of the function:
This change makes it easier to understand that |
||
|
|
||
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.
Here are some suggestions to optimize your code and address potential issues:
Optimizations
Batch Updates: Instead of updating each field individually, batch update the
Folderobject with all changes at once usingbulk_update. This can improve performance by reducing SQL queries.Avoid Duplicate Updates: Check if an update is necessary before making it. For example, only refresh from DB after the move operation.
Error Handling Consistency: Ensure consistent error messages across different parts of the function.
Resource Management: If moving folders, consider opening resources (like database connections) for a shorter duration.
Code Changes
Further Suggestion
This revision reduces the number of individual updates made to the
Folderobject and ensures that the resource is opened for as short a time as possible during critical operations.