Skip to content

Conversation

@iOvergaard
Copy link
Contributor

@iOvergaard iOvergaard commented Nov 6, 2025

Summary

Fixes pickers showing blank when the referenced item has been deleted. Now displays a clear error state with meaningful information (file path or GUID) and allows users to remove the broken reference.

This fix applies to 10 picker types:

  • Static file pickers (block thumbnails, stylesheets, scripts, etc.) - Shows file path
  • Document pickers - Shows document GUID
  • Member pickers - Shows member GUID
  • Document type pickers - Shows document type GUID
  • User pickers - Shows user GUID
  • Language pickers - Shows language GUID
  • Media type pickers - Shows media type GUID
  • Member type pickers - Shows member type GUID
  • Member group pickers - Shows member group GUID
  • User group pickers - Shows user group GUID

Changes

Infrastructure

  • Added errorDetail property to umb-entity-item-ref to display additional context in error states
  • Made _removeItem protected in UmbPickerInputContext for better extensibility
  • Added protected getItemDisplayName() method to UmbPickerInputContext for extensible display name formatting
  • Moved requestRemoveItem logic to base class to eliminate duplicate code

Picker Updates

All 10 pickers now:

  • Observe statuses from UmbRepositoryItemsManager instead of just selectedItems
  • Render based on status state (success vs error)
  • Show error state with GUID (or file path for static files) when item is missing
  • Use umb-entity-item-ref for error display
  • Use specialized components for successful items
  • Allow removal with proper confirmation dialog showing meaningful information

Affected pickers:

  1. umb-input-static-file - Overrides getItemDisplayName() to show file path
  2. umb-input-document - Uses default GUID display
  3. umb-input-member - Uses default GUID display
  4. umb-input-document-type - Uses default GUID display
  5. umb-user-input - Uses default GUID display
  6. umb-input-language - Uses default GUID display
  7. umb-input-media-type - Uses default GUID display
  8. umb-input-member-type - Uses default GUID display
  9. umb-input-member-group - Uses default GUID display
  10. umb-user-group-input - Uses default GUID display

Test plan

General Testing (applies to all pickers)

For each picker type below:

  1. Create or configure an entity that uses the picker
  2. Select an item using the picker
  3. Delete the selected item (and empty trash if applicable)
  4. Reload the page and view the picker
  5. ✅ Verify the picker shows "Not Found" with a red alert icon and the item identifier in the detail
  6. ✅ Click remove and verify the confirmation dialog shows the identifier instead of "Not found"
  7. ✅ Verify you can successfully remove the broken reference

Static File Picker

Test with block thumbnails, stylesheets, scripts, etc.

  • Shows file path as errorDetail (e.g., /media/image.jpg)

Document Picker

Test with content property using document picker

  • Shows document GUID as errorDetail

Member Picker

Test with content property using member picker

  • Shows member GUID as errorDetail

Document Type Picker

Test with document type allowed child types

  • Shows document type GUID as errorDetail

User Picker

Test with user assignments/permissions

  • Shows user GUID as errorDetail

Language Picker

Test with language selection fields

  • Shows language GUID as errorDetail

Media Type Picker

Test with media type selection

  • Shows media type GUID as errorDetail

Member Type Picker

Test with member type selection

  • Shows member type GUID as errorDetail

Member Group Picker

Test with member group assignments

  • Shows member group GUID as errorDetail

User Group Picker

Test with user group assignments

  • Shows user group GUID as errorDetail

Code Quality

  • Net addition of 141 lines across all changes
  • Eliminated duplicate code across multiple picker contexts
  • Improved maintainability through base class implementation
  • Consistent error handling pattern across all 10 picker types

Issues

Fixes #19329
Fixes #20270
Fixes #20367

🤖 Generated with Claude Code

iOvergaard and others added 4 commits November 6, 2025 21:48
Add optional errorDetail property to display additional context
(such as file paths or IDs) in error states. This enhances the
error display to show both the error message and relevant details.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Change #removeItem from private to protected to allow subclasses
to reuse the removal logic while customizing the confirmation dialog.
This enables better extensibility for specialized picker contexts.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Update umb-input-static-file to observe statuses and render based
on item state (loading, error, success). When a static file is
missing (API returns empty array), displays error state with alert
icon and file path detail using umb-entity-item-ref.

Also adds standalone property support for proper single-item styling.

Fixes #19329

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Override requestRemoveItem in UmbStaticFilePickerInputContext to
display the file path instead of "Not found" in the confirmation
dialog when removing missing static files.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Copilot AI review requested due to automatic review settings November 6, 2025 20:51
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 enhances the static file picker input component to display error states for items that cannot be retrieved from the server, and adds a confirmation modal before removing static file items.

Key changes:

  • Integrates repository status tracking to show error states for unavailable static files
  • Adds removal confirmation modal with customized message showing file path when item name is unavailable
  • Updates the entity-item-ref component to support displaying error detail information

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
input-static-file.element.ts Updated to render items based on repository statuses, passing error states and details to umb-entity-item-ref component
input-static-file.context.ts Overrides requestRemoveItem to show confirmation modal with fallback to file path when item name is unavailable
picker-input.context.ts Changed _removeItem from private to protected to allow override in subclasses
entity-item-ref.element.ts Added errorDetail property to display additional error information, reorganized item getter/setter, and fixed property access consistency

@iOvergaard iOvergaard changed the title Fix: Show error state for missing static files in pickers Static File Picker: Show error state for picked static files if they were deleted later (block thumbnails, stylesheets, etc) (closes #19329) Nov 6, 2025
iOvergaard and others added 3 commits November 6, 2025 22:00
Display the document GUID as errorDetail when a document is
not found (deleted/gone). This provides useful context for
editors to identify which document was referenced.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Display the document GUID instead of "Not found" in the remove
confirmation dialog when the document no longer exists. This
provides useful context for editors.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@iOvergaard iOvergaard changed the title Static File Picker: Show error state for picked static files if they were deleted later (block thumbnails, stylesheets, etc) (closes #19329) Static File Picker: Show error state for picked static files if they were deleted later (block thumbnails, stylesheets, etc) (closes #19329, #20270) Nov 6, 2025
iOvergaard and others added 2 commits November 6, 2025 22:36
Eliminated duplicate code across three picker contexts by:
- Adding protected getItemDisplayName() method to base class
- Moving requestRemoveItem implementation to base class
- Removing duplicate implementations from document, member, and static file pickers
- Static file picker overrides getItemDisplayName() to show file path

Net reduction: 19 lines of code (69 removed, 50 added)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Apply the same error state handling to the document type picker that was
implemented for static files, documents, and members. When a referenced
document type is missing or deleted:

- Show error state with the GUID as errorDetail
- Allow removal with proper confirmation dialog
- Use umb-entity-item-ref for error display
- Use uui-ref-node-document-type for successful items

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@iOvergaard iOvergaard changed the title Static File Picker: Show error state for picked static files if they were deleted later (block thumbnails, stylesheets, etc) (closes #19329, #20270) Picker Error States: Show error for missing items in static file, document, member, and document type pickers (closes #19329, #20270, #20367) Nov 6, 2025
…uage, media-type, member-type, member-group, and user-group pickers

Apply the same error state handling pattern to six additional picker types:
- user-input: Users
- input-language: Languages
- input-media-type: Media types
- input-member-type: Member types
- input-member-group: Member groups
- user-group-input: User groups

All pickers now:
- Observe statuses from UmbRepositoryItemsManager
- Show error state with GUID when referenced item is missing/deleted
- Use umb-entity-item-ref for error display
- Use specialized components (uui-ref-node, umb-user-group-ref, etc.) for successful items
- Allow removal with proper confirmation dialog showing GUID

Maintains code reusability by using the base class requestRemoveItem method
with getItemDisplayName() for consistent error handling across all pickers.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@iOvergaard iOvergaard changed the title Picker Error States: Show error for missing items in static file, document, member, and document type pickers (closes #19329, #20270, #20367) Picker Error States: Show error for missing items in 10 picker types (closes #19329, #20270, #20367) Nov 6, 2025
@iOvergaard iOvergaard changed the title Picker Error States: Show error for missing items in 10 picker types (closes #19329, #20270, #20367) Backoffice Item Pickers: Show error for missing items in 10 picker types (closes #19329, #20270, #20367) Nov 6, 2025
@iOvergaard iOvergaard requested a review from Copilot November 6, 2025 22:04
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

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.

Copy link
Member

@nielslyngsoe nielslyngsoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I skimmed through the code just to see if everything looked alright, and it does!

I will not test it, so leave that to someone else for now, just a minor comment:
There is a few component that have lost their #renderItem method. But some neither have had this. But an improvement could be to align this across, so all have such, I think that could lower the complexity a bit and it seems like a nice alignment :-)

- Add #renderItem to user-input (extracted from inline repeat callback)
- Change _renderItem to #renderItem in user-group-input for consistency
- Change _renderItem to #renderItem in input-static-file for consistency

All 10 pickers now use consistent #renderItem helper method pattern,
improving code readability and maintainability as suggested by @nielslyngsoe
@iOvergaard
Copy link
Contributor Author

There is a few component that have lost their #renderItem method. But some neither have had this. But an improvement could be to align this across, so all have such, I think that could lower the complexity a bit and it seems like a nice alignment :-)

Good suggestion, I aligned the pickers so they all have #renderItem now (some were renamed from _renderItem as well to match).

@leekelleher leekelleher enabled auto-merge (squash) November 10, 2025 12:23
Copy link
Member

@leekelleher leekelleher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested out, all looking great, working as expected! 🚀

I made some code amends, nothing functional, mostly import sorting, tidy-up.

@leekelleher leekelleher merged commit ab51aac into main Nov 10, 2025
28 checks passed
@leekelleher leekelleher deleted the v17/bugfix/remove-not-found-static-item branch November 10, 2025 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

4 participants