manager-ui
manager-ui copied to clipboard
Content/Schema: Media fields locked to a deleted Media group breaks media modal in Content
Describe the bug When Media fields are locked to a group; and then that group is deleted. Trying to add an image to that field in content results in a modal that loads endlessly & does not give the user an error.
To Reproduce Steps to reproduce the behavior:
- Navigate to Schema and create a media field and lock it to a subfolder/group
- Navigate to Media & delete the folder/group that the item was locked to in
- Navigate to content item that that you added the field to in #1 and try to add an image.
- See that the media modal loads endlessly without giving the user an error.
Expected behavior When a media group is deleted, the media field in the Content section should give the user a verbose error stating that the Media group no longer exists & another group must be linked to the field in the Schema section.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: Mac
- Browser Chrome
- Version 88
Additional context Legacy behaves differently than Manager UI. When a group is deleted it will still show that group as linked in Schema, however it will show a 404 error in the media modal in the content section.
@nibblebot I wonder if we could fetch the locked group from the API and if not present show a field configuration error and disable the media selection button.
Prior art on how we can handle this case is the erorr shown when a related field can not resolve a previously selected item. e.g. the related item has been deleted.
The media field when it has a locked group setting could look up all media groups when the media fields loads and make a determination on whether the selected locked group exists. If it does not could show an error.
Considerations: Performance. There are customers with extremely complex content items which require loading many API endpoints to resolve all the related data, this would be yet another request added to the cost of rendering this view. Not sure if this will have a material impact but I think worth noting.
This has been handled by the new Media app.
"See that the media modal loads endlessly without giving the user an error" is no longer an error since "Folder not found" is now displayed
Schema side has also been resolved. Showing a warning message when this occurs