Don't rerender the islands which stay the same

When a request is sent from an interactive view panel (for example, if we move an instance in Builder, Layers or Tree panels; if we change the settings in InstanceForm), the HTMX response has OOB-Swap also to replace content in this panel.

It seems useless to replace something already in the right state, and it add weight to the HTTP Response body and one swap more for HTMX.

Can we skip it? We may need to add a triggering_panel value in the HTTP Request.

Don't trigger useless "move" requests

If we drag a source to the same slot, same position, the set (instance, slot, position) will be the same, nothing will change in the StateManager, so we don't need to trigger the HTTP request.

Don' forget to do the same for the root dropzone.

Moved to its own issue: #3544361: Don't trigger useless "move" requests

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

pdureau created an issue. See original summary.

pdureau’s picture

Title: [1.0.0-beta1] Don't trigger useless requests and replace unchanged panels » Don't trigger useless requests and replace unchanged panels
Issue tags: +display_builder-1.0.0-beta
pdureau’s picture

Issue summary: View changes
mogtofu33’s picture

Assigned: Unassigned » mogtofu33
Issue tags: -display_builder-1.0.0-beta +display_builder-1.0.0-alpha4
mogtofu33’s picture

Assigned: mogtofu33 » Unassigned
Priority: Normal » Major
pdureau’s picture

This may also help the use of iframe in builder and preview panels

pdureau’s picture

pdureau’s picture

Assigned: Unassigned » pdureau
Status: Active » Needs work

Let's go

pdureau’s picture

This may also the opportunity of tidying ApiController:

  • Move builder and island id to properties?
  • Merge update and thirdPartySettingsUpdate ?
pdureau’s picture

So, when do we want to block refresh:

  • BuilderPanel & LayersPanel: onRootDrop and onSlotDrop, but only on move (because we need the refresh to get the placeholder replacement when on add)
  • InstanceFormPanel: onInstanceFormChange and onInstanceUpdateButtonClick
  • ThirdPartySettings panels (UI Styles, UI Skins...)

Other islands triggering HTMX events but which needs to be refreshed:

  • HistoryButton (onUndo, onRedo, onClear)
  • MenuDelete (onClickDelete)
  • StateButtons (onSave, onReset, onRevert)
  • Menu (onClickDuplicate, onClickPaste)

Those islands don't trigger events:

  • ViewportSwitcher
  • ComponentLibraryPanel
  • BlockLibraryPanel
  • ...
pdureau’s picture

Title: Don't trigger useless requests and replace unchanged panels » Don't replace unchanged panels
Issue summary: View changes
pdureau’s picture

Issue summary: View changes
pdureau’s picture

We will also do those non-relaetd tasks:

  • Merge InfoPanel into InstanceForm panel
  • Add readonly keywords to HistoryStep

pdureau’s picture

Assigned: pdureau » mogtofu33
Status: Needs work » Needs review
pdureau’s picture

Assigned: mogtofu33 » pdureau
Status: Needs review » Needs work

Maybe the opportunity of little clean-up

pdureau’s picture

Assigned: pdureau » mogtofu33
Status: Needs work » Needs review

2 things to be careful about:

  • If the UIP2 AJAX issue is solved on 1.0.x (to be confirmed), it is not the case in ths MR so it may be a regression
  • the last commit Remove previous use of current_island_id is a bit bold with the removal of a badly understood mechanism:
-    if ($form_state->isRebuilding() && (!isset($options['current_island_id']) || $this->getPluginId() === $options['current_island_id'])) {
+    if ($form_state->isRebuilding()) {

if there is any doubt, let's revert it and move the change to a dedicated issue

If we merge it like that, here is the related Dev Tools issue: #3544616: Follow IslandEventSubscriberInterface::onUpdate() changed

pdureau’s picture

Assigned: mogtofu33 » Unassigned
Status: Needs review » Fixed

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

pdureau’s picture

Status: Fixed » Closed (fixed)