Entity Data Picker: Fix "Not Found" in remove dialog for entities without a top-level name#22915
Conversation
|
Claude finished @madsrasmussen's task in 5m 4s —— View job PR ReviewTarget: Generalises the variant-aware name resolution that already existed in
Suggestions
ApprovedClean, well-tested fix. The optional strategy on |
There was a problem hiding this comment.
Pull request overview
This PR fixes the “Not Found” label in the Entity Data Picker remove confirmation dialog for entity types (notably Documents) whose display name is not stored on a top-level item.name, by allowing the active picker data source to provide an item data resolver for display-name resolution.
Changes:
- Adds an optional
createItemDataResolver(host)factory method toUmbPickerDataSourceso data sources can control how picked item metadata (e.g., display name) is resolved. - Updates
UmbEntityDataPickerInputContextto use the data source’s resolver (when available) to resolve the remove-dialog display name. - Adds unit tests covering resolver usage and fallback behavior; updates the example document picker data source to supply
UmbDocumentItemDataResolver.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Umbraco.Web.UI.Client/src/packages/property-editors/entity-data-picker/input/input-entity-data.context.ts | Uses a data-source-provided resolver to compute the remove-dialog item name, enabling variant/language-aware names. |
| src/Umbraco.Web.UI.Client/src/packages/property-editors/entity-data-picker/input/input-entity-data.context.test.ts | Adds tests validating resolver path + fallback behaviors for _requestItemName. |
| src/Umbraco.Web.UI.Client/src/packages/core/picker-data-source/data-source/types.ts | Extends the picker data source contract with an optional resolver factory. |
| src/Umbraco.Web.UI.Client/examples/picker-data-source/example-document-picker-data-source.ts | Demonstrates createItemDataResolver using UmbDocumentItemDataResolver for document names/icons. |
…hout a top-level name (#22915) * Add item data resolver support to picker data sources * add js docs * remove duplicated fallback logic * wip unit tests of requestItemName method * Use DocumentVariantStateModel in mock documents to fix compiler * Update input-entity-data.context.ts * Update input-entity-data.context.test.ts (cherry picked from commit c74a582)
* Element Tree Picker Data Source: adds item data resolver This follows PR #22915, which fixes the Entity Data Picker's removal confirmation message with the entity's name. * Adds support for `UmbElementFolderItemDataResolver`
Root cause:
The base _requestItemName reads item.name. Document entities store their names in
variants[x].name(language-context-dependent) and have no top-levelnameproperty, so the remove confirmation dialog always showed "Not Found".Summary
createItemDataResolver? factory method toUmbPickerDataSource— data sources can implement it to control how a picked item's display name (and other metadata) is resolvedUmbEntityDataPickerInputContextoverrides_requestItemNameto call the factory when available, passing itself as the controller host so the resolver can reach local DOM contexts such asUMB_VARIANT_CONTEXTExampleDocumentPickerPropertyEditorDataSourceexample to implementcreateItemDataResolverusing the existingUmbDocumentItemDataResolverTest plan
npm run examplecreateItemDataResolver— falls back to item.name (existing behaviour, unaffected)