Active
Project:
Drupal Canvas
Version:
1.x-dev
Component:
Data model
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
23 Dec 2024 at 09:28 UTC
Updated:
26 May 2025 at 16:20 UTC
Jump to comment: Most recent
Following the work in #3494114: Implement auto-save of the page template config entity the special root UUID feels pointless to me now; it's a pointer to a set of components, so can't the root just be an array of components directly? Additionally, a UUID is supposed to uniquely identify something, but here we are reusing it to mean "the root of any component tree", so you can have two separate trees with the same root UUID, which conceptually feels wrong to me.
This issue exists to explore whether removing it is feasible to do.
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 #2
tedbowIt seems like this should be stable blocker decide at least if we want to do this. If we do it is probably better before stable otherwise I think we would have to write an update hook that would update all content entities to use the new structure.
Comment #3
effulgentsia commentedComment #4
wim leersThis also relates to #3455629: [PP-1] [META] 7. Content Templates — aka "default layouts" — affects the tree+props data model: once content type template exists, the following scenario can occur:
Comment #5
wim leersContentTemplateconfig entities now exist.#3517845: Content templates, part 3a: allow content templates to define exposed slots is in, and #3519352: Content templates, part 3b: store exposed slot subtrees on individual entities is being worked on. @phenaproxima, any thoughts on this given you're actively working on #3519352? 😄
Comment #6
phenaproximaWell, at the moment, #3519352: Content templates, part 3b: store exposed slot subtrees on individual entities uses the root UUID to know what components in a subtree need to be injected directly into an exposed slot, and which components are just added to the main tree.
Having said that, though, what would the tree structure look like if we made this change (how would it represent infinite nesting)? That would help me understand any knock-on effects for exposed slots.
Comment #7
phenaproximaBack to Wim for answers. :)
Comment #8
wim leers#3468272: Store the ComponentTreeStructure field property one row per component instance will likely implicitly address this.
Comment #9
wim leersIOW: this will likely be closed. Let's hope. 🤞
Comment #10
wim leersWhen this issue was opened, every component tree in XB was self-contained. But with #3455629: [PP-1] [META] 7. Content Templates — aka "default layouts" — affects the tree+props data model getting implemented, that will change:
ContentTemplate, it's possible that each individual content entity does NOT define the full component tree, but only bonsai trees (see #3519352: Content templates, part 3b: store exposed slot subtrees on individual entities) to populate theContentTemplate's exposed slots — aka the "islands of freedom", but the root of the tree would be the same for all content entities.ContentTemplate, and each content entity would not store one component tree (starting at the root), but multiple bonsai trees (staring at slot of a component instance in theContentTemplate's component tree whose slot was explicitly exposed).In that world, to be able to distinguish where the root begins and ends. For a moment, I thought while reviewing #3468272's MR that we'd need to keep the root UUID. But thanks to
ValidParentAndSlotConstraintValidator's logic in that MR, I think we don't! Would be good to have @larowlan confirm :)Comment #11
larowlanI think the front-end is still using it, so we will need to handle that at the same time, but yes, the path to removing it is clearer after that
Comment #12
wim leers👍
(Although I don't see how the front end using it is relevant: the client-side data model already is very different from the server-side one. It'd be fine for the client to continue to have such a root UUID. This issue is solely about the server-side data model.)
Comment #13
wim leersReviewing #3468272: Store the ComponentTreeStructure field property one row per component instance right now, it 100% certainly addresses this! 🥳
Comment #14
wim leersActually — I'm kinda wrong in my prior comment!
That MR mostly addressed this:
ComponentTreeItemList::constructDepthFirstGraph()) and hence when rendering, B) when performing the client-to-server conversionWe should still remove it, but it's actually only used internally now; so refactoring it away is essentially a purely internal change 🥳
So: reducing priority, retitling, rescoping.
Comment #15
wim leers