Desktop: Fix reorder not beeing persisted#4002
Open
timon-schelling wants to merge 1 commit intomasterfrom
Open
Desktop: Fix reorder not beeing persisted#4002timon-schelling wants to merge 1 commit intomasterfrom
timon-schelling wants to merge 1 commit intomasterfrom
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request renames set_document_order to force_document_order and updates its implementation to synchronize the document store's order. Additionally, the force_order method was refactored to accept a slice instead of a vector reference and no longer truncates the document list. A review comment suggests reordering operations in force_document_order to avoid an unnecessary unwrap() call by passing the reference before moving the value.
Comment on lines
71
to
+72
| self.document_order = Some(order); | ||
| self.documents.force_order(self.document_order.as_ref().unwrap()); |
Contributor
There was a problem hiding this comment.
The unwrap() call can be avoided by reordering the operations. Passing a reference to order before moving it into self.document_order is more idiomatic and avoids an unnecessary unwrap() on a value that was just assigned.
Suggested change
| self.document_order = Some(order); | |
| self.documents.force_order(self.document_order.as_ref().unwrap()); | |
| self.documents.force_order(&order); | |
| self.document_order = Some(order); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.