Spike: Explore storing component inputs in separate columns (aka field union)

Created on 12 May 2025, 26 days ago

Problem/Motivation

At present we store component inputs in a JSON blob.

This means we cannot efficiently query components as it is just a large JSON Blob. πŸ“Œ [PP-1] Evaluate storing XB field type's "deps_*" columns in separate table Active does allow us to at least identify which entities are using which plugins/components but it doesn't provide any path for updates. So for example if a block changes its settings, we have to loop over every revision and search for components and then update the whole blob.

Proposed resolution

Store the data normalized - in the same way that we currently do for field API fields in core. But instead of one table per field (prop) we would have one table per component version (set of fields)

I had wondered whether we actually need two config entity types at all - i.e. could field union directly use a component config entity type instead of using its own, or could XB directly use field unions without an extra entity type in-between, but... no idea whether that would even be desirable even if it's possible.

- From #3477428-10: Refactor (or decide not to) the XB field type to be multi-valued, to de-jsonify the tree, and to reference the field_union type of the prop values β†’

I think we don't need a lot of the complexity of Field Union module and it would instead be better to borrow the concept of field-type derivatives from Field Union. i.e. We can derive one field-type plugin per component and version πŸ“Œ Version component prop definitions for SDC and Code components Active

Spike outcomes, some of these may be split into separate child stories:

  1. Evaluate if this is even feasible
  2. Try to do it in a storage layer that supports one table per component (version), not one per component version per entity type (as is the case with fields in core)
  3. Explore if we can do it without requiring field definitions for each component (field derivative). This will bloat the field map and lead to performance issues
  4. Explore the impact on the number of tables and joins this will entail - we can expect there might be up to 50 different component types in a given site, possibly more. We will likely also need to store versions of components in separate tables if new props are added or data-types change. So there might be as many as 100 tables. That's assuming we can reuse the same table across multiple entity-types. If we have one table per field per entity-type.
  5. Explore decorating SqlContentEntityStorage and storage handler that extend from it to support loading of this data in a single query during standard entity load even though we're not making use of standard fields here
  6. Explore what views integration would look like
  7. Explore nested field definitions for object and array shape data
  8. Explore making this something component source plugins control as it doesn't apply to all source plugins
  9. Explore what this would like for e.g. Block settings that whilst modeled using config schema (and therefore typed data) are arbitrary in shape and would traditionally be stored in a serialized column

User interface changes

πŸ“Œ Task
Status

Active

Version

0.0

Component

Data model

Created by

πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024