Problem/Motivation

We replicated the current core pattern by sending the asset json as an additional element to add to dom and then processing it.

Instead we can use HX-Trigger-After-Settle (see https://htmx.org/headers/hx-trigger/) to send the json and trigger it to be processed

Proposed resolution

  1. Improve the code architecture of htmx-assetManagement.js and htmx-drupalBehaviors.js based on prior feedback.
  2. Change HtmxResponseAttachmentsProcessor to add a HX-Trigger-After-Swap header. In the header pass the event htmxDrupalAssetsAttached along with the JSON encoded asset arrays.
  3. Listen for and process the custom event in htmx-assetManagement.js.

Issue fork htmx-3459112

Command icon 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

FatherShawn created an issue. See original summary.

fathershawn’s picture

fathershawn’s picture

Issue summary: View changes
fathershawn’s picture

Issue summary: View changes

fathershawn’s picture

Status: Active » Needs review
fathershawn’s picture

Issue summary: View changes
fathershawn’s picture

In addition to all check green, manual test is good. Merging

  • FatherShawn committed 0598e161 on 1.2.x
    Issue #3459112 by FatherShawn: Refactor asset and behaviors management...
fathershawn’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.