Last week was quiet on the front end. This week thereâs two big leaps forward!
Leap #1
Experience Builderâs (XB) right sidebar has two tabs:
- âSettingsâ (for the per-component âsettingsâ), which for Single Directory Components (SDCs) shows a form to populate its props
- âPage dataâ, intended to allow modifying the the page youâre looking at if itâs a content entity. In other words: it should show the typical Drupal node form to edit the content entityâs structured data. But with a major twist: all field widgets must be rendered using React, and their values synced with Redux, to allow live updates in XBâs preview.
So, this weekâs first leap is BĂĄlint âbalintbrewsâ KlĂ©ri and Ben âbnjmnmâ Mullins having made that second point a reality:
Issue #3469235, image by BĂĄlint.
This builds upon the infrastructure that Ben introduced. Pretty incredible to see the most canonical Drupal form weâre all (too?) familiar with rendered in a novel way, isnât it? đ
Leap #2
The second leap on the other hand is completely invisible: Jesse Baker, BĂĄlint âbalintbrewsâ KlĂ©ri and Harumi âhooromooâ Jang kept the live previews of the edited page looking the same, but overhauled almost the entire implementation! đź You may remember that in week 19, Jesse introduced the IframeSwapper
to eliminate flickering.
But still plenty of challenges remained due to XBâs reliance on <iframe>
s: all events occurring inside them need bubbling up (to allow for panning the canvas), interactions occurring near their boundaries feel off, correctly positioning the âhovered/selectedâ component instance affordances requires cross-frame communication, and more.
Jesse landed on an impressive solution: he built an invisible, overlaid, representation of the components present in the preview in the parent on top of the preview <iframe>
, preventing the user for interacting with the iframe directly at all. The trade-off: now that invisible overlay must be perfectly in sync with the preview behind it, even while panning and zooming. He aptly named it mirror universe đ§
Want more detail? Jesseâs page-preview.md
is a fascinating read!
Prep for the future
A tiny bugfix by Shyam Bhatt , Kyle âctrladelâ Einecker and Ben âbnjmnmâ Mullins to fix the hardcoded dummy data for sections1. The use of dummy data hardcoded in the React UI allows XBâs front end to race ahead of its back end: there, a config entity plus HTTP API needs to be defined for them â that will happen in #3479643 and #3479982.
The PageTemplate
config entity was added last week, this week Ted âtedbowâ Bowman, Dave âlongwaveâ Long and I added a HTTP API for the XB UI to create, read, update and delete XB config entities. Key bits of logic are lifted from Drupal coreâs JSON:API, specifically from a core merge request: #2300677: JSON:API POST/PATCH support for fully validatable config entities , which did not land yet.
I was pleasantly surprised that ApiConfigControllers
only took ~300 LoC, although (de)normalization is missing: the back end is racing ahead of the client here, and deciding on the ideal client-side representation should happen when the front end work happens. The config entityâs full lifecycle is tested, to ensure beyond the basics also correct cacheability, use of Dynamic Page Cache, and usable detailed validation errors.
Finally, for the third week in a row, adjustments were made to allow for multiple component types, this time in the HTTP API and UI internals. Itâs coming soon now, I promise!
Week 24 was October 21âOctober 27, 2024.
- 1
A âsectionâ is a reusable pattern: a combination of components that is available to be reused.