Overview
Received a report that after renaming some components and pushing them to the site via CLI resulted in a folder operations not completing. Some console output was shared and I'll include some highlights:
PATCH https://174207-c06b95bd-28da-4faf-add8-41ec7f499b82.cms.acquia.site/canvas/api/v0/config/folder/0457e657-54f5-4b9a-8344-5ec6958a37f3 422 (Unprocessable Content)
lte @ index.js?v=1.3.3:433
index.js?v=1.3.3:2553 RTK Query error:
{status: '422', errors: {…}, message: "The 'canvas.component.js.media-feature-grid' config does not exist."}Proposed resolution
When a "rename" occurs, it's actually a delete + create. A folder that contains the now-deleted component is never made aware of this deletion. If an operation is performed on the folder, it will fail the ConfigExists constraint if any item in the folder does not exist.
This suggests we should, on component deletion, also remove it from any folder it might be in.
User interface changes
Issue fork canvas-3591130
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
bnjmnmCI isn't accurate at the moment due to some ripple effect of a recent core / Twig security update so it's possible there are some issues that CI would otherwise expose that I'm not yet aware of. However, given that it's a pretty simple change, I'm setting to NR anyway and once CI fully runs I'll clean up anything it catches.
Full fix and test-only branches provided.
Comment #5
wim leers🤯 Woah! What a find!
We support
Folders of any config entity type. But AFAICT becauseFoldertoday just inheritsConfigEntityBase::preDelete()+ConfigEntityBase::onDependencyRemoval(), any dependency that gets deleted should actually in principle result in theFolderitself getting deleted?And that's not happening because …
Folderdoesn't compute dependencies right now 😬 This is a big oversight in the MR/issue that introducedFolders. https://git.drupalcode.org/project/experience_builder/-/merge_requests/1429Comment #6
bnjmnmThx @wim leers, was not aware of the dependency handling capabilities, but makes sense to have it as the alternative could get unwieldy.