-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Item Repository: Sort statuses by order of unique #20603
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
Conversation
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.
Pull Request Overview
This PR addresses a synchronization issue between the UI order and the internal sort model in the Item Repository. When iterating through the status array, the order was not being maintained correctly. The changes ensure that the statuses array is kept in sync with the unique items' sort order by implementing a new replace method and deprecating the now-unnecessary removeStatus method.
Key changes:
- Introduced a
replacemethod forUmbArrayStateto update existing items while preserving order - Modified
UmbRepositoryItemsManagerto synchronize status sorting with item sorting - Deprecated the
removeStatusmethod as statuses are now automatically managed viasetUniques
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/Umbraco.Web.UI.Client/src/packages/core/repository/repository-items.manager.ts |
Updated status management to sort by unique order, deprecated removeStatus method, changed from append to replace for status updates |
src/Umbraco.Web.UI.Client/src/packages/core/picker-input/picker-input.context.ts |
Removed now-deprecated removeStatus call from item removal logic |
src/Umbraco.Web.UI.Client/src/libs/observable-api/utils/replace-in-unique-array.function.ts |
New utility function to replace items in unique arrays by matching unique identifiers |
src/Umbraco.Web.UI.Client/src/libs/observable-api/utils/index.ts |
Exported the new replaceInUniqueArray function |
src/Umbraco.Web.UI.Client/src/libs/observable-api/states/array-state.ts |
Added replace method to support replacing existing entries while maintaining array order |
src/Umbraco.Web.UI.Client/src/libs/observable-api/states/array-state.test.ts |
Added test coverage for the new replace method and updated test variable naming from subject to state |
src/Umbraco.Web.UI.Client/src/libs/observable-api/utils/replace-in-unique-array.function.ts
Show resolved
Hide resolved
src/Umbraco.Web.UI.Client/src/libs/observable-api/utils/replace-in-unique-array.function.ts
Outdated
Show resolved
Hide resolved
src/Umbraco.Web.UI.Client/src/libs/observable-api/states/array-state.ts
Outdated
Show resolved
Hide resolved
…-state.ts Co-authored-by: Copilot <[email protected]>
* utility * ability to replace * deprecate removeStatus * no need to call this any longer * Sort statuses and ensure not appending statuses, only updating them # Conflicts: # src/Umbraco.Web.UI.Client/src/packages/core/repository/repository-items.manager.ts
* utility * ability to replace * deprecate removeStatus * no need to call this any longer * Sort statuses and ensure not appending statuses, only updating them # Conflicts: # src/Umbraco.Web.UI.Client/src/packages/core/repository/repository-items.manager.ts
Since we now iterate through the status array, the UI order is no longer synchronized with the order model. The PR ensures that the statuses array order is kept in sync with the sort model order.