- Issue created by @fathershawn
- π©πͺGermany Fabianx
From Slack:
Great work! And great work to get the first patch in.
I pondered the messages issue a little bit - from your big refactor and I would suggest do do two template elements.
One is a type=messages stream and one is simple replacements like the big pipe elements you already had.
That way:
- You keep it simple.
- You keep the HTML as the format for data
- Messages stream is several
β<messages>β
HTML elements (or whatever you want to define), which you parse back to JS and then use the Drupal.message() API (simple 1:1 mapping from HTML to API call -> 1 element for each API call)
That way:
- Everything is template elements
- HTML is the data format
- Messages are added by JS (as we defined they would be)
- BigPipe is still a very simple .swap operation with the placeholder by default
- πΊπΈUnited States fathershawn New York
I very much affirm HTML as the data format.
In my last draft I was sending individual messages as HTML but I now think that all we need to do is render the messages normally using
'#theme' => 'status_messages'
. If the theme provides the selector for the wrapper element, with fallback to corediv[data-drupal-messages]
we can start get the innerHTML of the incoming wrapper and swap it into the existing wrapper in the DOM using the HTMXbeforeend
strategy. - πΊπΈUnited States fathershawn New York
Discussed with @nod_ yesterday. He pointed out that we can communicate in a CR that themes need to apply the
data-drupal-messages
attribute to their wrapper element.