Skip to content

Conversation

@nielslyngsoe
Copy link
Member

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.

Copilot AI review requested due to automatic review settings October 22, 2025 09:03
@nielslyngsoe nielslyngsoe enabled auto-merge (squash) October 22, 2025 09:03
Copy link
Contributor

Copilot AI left a 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 replace method for UmbArrayState to update existing items while preserving order
  • Modified UmbRepositoryItemsManager to synchronize status sorting with item sorting
  • Deprecated the removeStatus method as statuses are now automatically managed via setUniques

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

@madsrasmussen madsrasmussen added release/17.0.0 type/bug status/regression A previously working feature that has broken or changed behavior unexpectedly labels Oct 22, 2025
@nielslyngsoe nielslyngsoe merged commit f6df0c1 into release/17.0 Oct 22, 2025
23 checks passed
@nielslyngsoe nielslyngsoe deleted the v17/hotfix/picker-sorting-take-2 branch October 22, 2025 09:42
nielslyngsoe added a commit that referenced this pull request Oct 22, 2025
* 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
AndyButland pushed a commit that referenced this pull request Oct 28, 2025
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release/17.0.0-rc1 release/17.0.0 status/regression A previously working feature that has broken or changed behavior unexpectedly type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants