Changes to code components are not visible in preview-on-hover-component-list until published

Created on 1 April 2025, 1 day ago

Overview

Extracted from #3512385-5: Changes to code components are not visible in A) preview-on-hover, B) global regions until published ā†’ :

āš ļø AFAICT this also affects the component preview upon hovering the list of available components:

Proposed resolution

  1. Always call ComponentSourceInterface::renderComponent() with isPreview: TRUE in ComponentSourceInterface::getClientSideInfo()
    diff --git a/src/Plugin/ExperienceBuilder/ComponentSource/BlockComponent.php b/src/Plugin/ExperienceBuilder/ComponentSource/BlockComponent.php
    index 4fbac989c..adb573f8d 100644
    --- a/src/Plugin/ExperienceBuilder/ComponentSource/BlockComponent.php
    +++ b/src/Plugin/ExperienceBuilder/ComponentSource/BlockComponent.php
    @@ -302,7 +302,7 @@ final class BlockComponent extends ComponentSourceBase implements ContainerFacto
           return ['build' => []];
         }
     
    -    return ['build' => $this->renderComponent([], $component->uuid())];
    +    return ['build' => $this->renderComponent([], $component->uuid(), TRUE)];
       }
     
       /**
    diff --git a/src/Plugin/ExperienceBuilder/ComponentSource/GeneratedFieldExplicitInputUxComponentSourceBase.php b/src/Plugin/ExperienceBuilder/ComponentSource/GeneratedFieldExplicitInputUxComponentSourceBase.php
    index c55528b5b..39653166a 100644
    --- a/src/Plugin/ExperienceBuilder/ComponentSource/GeneratedFieldExplicitInputUxComponentSourceBase.php
    +++ b/src/Plugin/ExperienceBuilder/ComponentSource/GeneratedFieldExplicitInputUxComponentSourceBase.php
    @@ -603,7 +603,7 @@ abstract class GeneratedFieldExplicitInputUxComponentSourceBase extends Componen
     
         return [
           'source' => (string) $this->getSourceLabel(),
    -      'build' => $this->renderComponent([self::EXPLICIT_INPUT_NAME => $default_props_for_default_markup], $component->uuid()),
    +      'build' => $this->renderComponent([self::EXPLICIT_INPUT_NAME => $default_props_for_default_markup], $component->uuid(), TRUE),
           // Additional data only needed for SDCs.
           // @todo UI does not use any other metadata - should `slots` move to top level?
           'metadata' => ['slots' => $this->getSlotDefinitions()],
    
  2. Ensure that any auto-save change is immediately reflected in the hovering, i.e. ensure the necessary client-side (and server-side) cache invalidation happens.

User interface changes

Component hover (instantaneously, aka without refreshing) shows the auto-saved (draft) version of a code component.Changes to code components are not visible in global regions until published

šŸ› Bug report
Status

Active

Version

0.0

Component

Internal HTTP API

Created by

šŸ‡§šŸ‡ŖBelgium wim leers Ghent šŸ‡§šŸ‡ŖšŸ‡ŖšŸ‡ŗ

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

Comments & Activities

Production build 0.71.5 2024