New blocks added don't update the preview when a setting is changed until saved

Created on 3 June 2025, 3 days ago

Overview

It seems that newly added blocks with settings don't refresh the preview, because it seems there is a 500 error. until the page is saved.

Steps to reproduce

  • Install a fresh site with XB
  • Enable xb_test_block module
  • Add Test block for Input Schema Change POC. block
  • Modify the Foo prop from Bar to Baz
  • Expect the preview to change to "Current foo value: baz", but it remains as "Current foo value: bar"

Any other block from xb_test_block module have the same issue, like "Test Block with settings".

User interface changes

🐛 Bug report
Status

Active

Version

0.0

Component

Page builder

Created by

🇪🇸Spain isholgueras

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

Comments & Activities

  • Issue created by @isholgueras
  • 🇪🇸Spain isholgueras

    This is the error that is thrown:

    {
        "message": "Body does not match schema for content-type \u0022application\/json\u0022 for Request [patch \/xb\/api\/v0\/layout\/{entityTypeId}\/{entityId}]. [Keyword validation failed: Data has additional properties (name) which are not allowed in model]",
        "file": "\/var\/www\/html\/vendor\/league\/openapi-psr7-validator\/src\/PSR7\/Exception\/Validation\/AddressValidationFailed.php",
        "line": 31,
        "trace": [
            {
                "file": "\/var\/www\/html\/vendor\/league\/openapi-psr7-validator\/src\/PSR7\/Exception\/Validation\/InvalidBody.php",
                "line": 19,
                "function": "fromAddrAndPrev",
                "class": "League\\OpenAPIValidation\\PSR7\\Exception\\Validation\\AddressValidationFailed",
                "type": "::"
            },
            {
                "file": "\/var\/www\/html\/vendor\/league\/openapi-psr7-validator\/src\/PSR7\/Validators\/BodyValidator\/UnipartValidator.php",
                "line": 60,
                "function": "becauseBodyDoesNotMatchSchema",
                "class": "League\\OpenAPIValidation\\PSR7\\Exception\\Validation\\InvalidBody",
                "type": "::"
            },
            {
                "file": "\/var\/www\/html\/vendor\/league\/openapi-psr7-validator\/src\/PSR7\/Validators\/BodyValidator\/BodyValidator.php",
                "line": 73,
                "function": "validate",
                "class": "League\\OpenAPIValidation\\PSR7\\Validators\\BodyValidator\\UnipartValidator",
                "type": "-\u003E"
            },
            {
                "file": "\/var\/www\/html\/vendor\/league\/openapi-psr7-validator\/src\/PSR7\/Validators\/ValidatorChain.php",
                "line": 25,
                "function": "validate",
                "class": "League\\OpenAPIValidation\\PSR7\\Validators\\BodyValidator\\BodyValidator",
                "type": "-\u003E"
            },
            {
                "file": "\/var\/www\/html\/vendor\/league\/openapi-psr7-validator\/src\/PSR7\/RequestValidator.php",
                "line": 79,
                "function": "validate",
                "class": "League\\OpenAPIValidation\\PSR7\\Validators\\ValidatorChain",
                "type": "-\u003E"
            },
            {
                "file": "\/var\/www\/html\/web\/modules\/contrib\/experience_builder\/src\/EventSubscriber\/ApiRequestValidator.php",
                "line": 44,
                "function": "validate",
                "class": "League\\OpenAPIValidation\\PSR7\\RequestValidator",
                "type": "-\u003E"
            },
            {
                "file": "\/var\/www\/html\/web\/modules\/contrib\/experience_builder\/src\/EventSubscriber\/ApiMessageValidatorBase.php",
                "line": 75,
                "function": "validate",
                "class": "Drupal\\experience_builder\\EventSubscriber\\ApiRequestValidator",
                "type": "-\u003E"
            },
            {
                "file": "\/var\/www\/html\/vendor\/symfony\/event-dispatcher\/EventDispatcher.php",
                "line": 246,
                "function": "onMessage",
                "class": "Drupal\\experience_builder\\EventSubscriber\\ApiMessageValidatorBase",
                "type": "-\u003E"
            },
            {
                "file": "\/var\/www\/html\/vendor\/symfony\/event-dispatcher\/EventDispatcher.php",
                "line": 206,
                "function": "Symfony\\Component\\EventDispatcher\\{closure}",
                "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
                "type": "::"
            },
            {
                "file": "\/var\/www\/html\/vendor\/symfony\/event-dispatcher\/EventDispatcher.php",
                "line": 56,
                "function": "callListeners",
                "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
                "type": "-\u003E"
            },
            {
                "file": "\/var\/www\/html\/vendor\/symfony\/http-kernel\/HttpKernel.php",
                "line": 159,
                "function": "dispatch",
                "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
                "type": "-\u003E"
            },
            {
                "file": "\/var\/www\/html\/vendor\/symfony\/http-kernel\/HttpKernel.php",
                "line": 76,
                "function": "handleRaw",
                "class": "Symfony\\Component\\HttpKernel\\HttpKernel",
                "type": "-\u003E"
            },
            {
                "file": "\/var\/www\/html\/web\/core\/lib\/Drupal\/Core\/StackMiddleware\/Session.php",
                "line": 53,
                "function": "handle",
                "class": "Symfony\\Component\\HttpKernel\\HttpKernel",
                "type": "-\u003E"
            },
            {
                "file": "\/var\/www\/html\/web\/core\/lib\/Drupal\/Core\/StackMiddleware\/KernelPreHandle.php",
                "line": 48,
                "function": "handle",
                "class": "Drupal\\Core\\StackMiddleware\\Session",
                "type": "-\u003E"
            },
            {
                "file": "\/var\/www\/html\/web\/core\/lib\/Drupal\/Core\/StackMiddleware\/ContentLength.php",
                "line": 28,
                "function": "handle",
                "class": "Drupal\\Core\\StackMiddleware\\KernelPreHandle",
                "type": "-\u003E"
            },
            {
                "file": "\/var\/www\/html\/web\/core\/modules\/big_pipe\/src\/StackMiddleware\/ContentLength.php",
                "line": 32,
                "function": "handle",
                "class": "Drupal\\Core\\StackMiddleware\\ContentLength",
                "type": "-\u003E"
            },
            {
                "file": "\/var\/www\/html\/web\/core\/modules\/page_cache\/src\/StackMiddleware\/PageCache.php",
                "line": 116,
                "function": "handle",
                "class": "Drupal\\big_pipe\\StackMiddleware\\ContentLength",
                "type": "-\u003E"
            },
            {
                "file": "\/var\/www\/html\/web\/core\/modules\/page_cache\/src\/StackMiddleware\/PageCache.php",
                "line": 90,
                "function": "pass",
                "class": "Drupal\\page_cache\\StackMiddleware\\PageCache",
                "type": "-\u003E"
            },
            {
                "file": "\/var\/www\/html\/web\/core\/lib\/Drupal\/Core\/StackMiddleware\/ReverseProxyMiddleware.php",
                "line": 48,
                "function": "handle",
                "class": "Drupal\\page_cache\\StackMiddleware\\PageCache",
                "type": "-\u003E"
            },
            {
                "file": "\/var\/www\/html\/web\/core\/lib\/Drupal\/Core\/StackMiddleware\/NegotiationMiddleware.php",
                "line": 51,
                "function": "handle",
                "class": "Drupal\\Core\\StackMiddleware\\ReverseProxyMiddleware",
                "type": "-\u003E"
            },
            {
                "file": "\/var\/www\/html\/web\/core\/lib\/Drupal\/Core\/StackMiddleware\/AjaxPageState.php",
                "line": 36,
                "function": "handle",
                "class": "Drupal\\Core\\StackMiddleware\\NegotiationMiddleware",
                "type": "-\u003E"
            },
            {
                "file": "\/var\/www\/html\/web\/core\/lib\/Drupal\/Core\/StackMiddleware\/StackedHttpKernel.php",
                "line": 51,
                "function": "handle",
                "class": "Drupal\\Core\\StackMiddleware\\AjaxPageState",
                "type": "-\u003E"
            },
            {
                "file": "\/var\/www\/html\/web\/core\/lib\/Drupal\/Core\/DrupalKernel.php",
                "line": 709,
                "function": "handle",
                "class": "Drupal\\Core\\StackMiddleware\\StackedHttpKernel",
                "type": "-\u003E"
            },
            {
                "file": "\/var\/www\/html\/web\/index.php",
                "line": 19,
                "function": "handle",
                "class": "Drupal\\Core\\DrupalKernel",
                "type": "-\u003E"
            }
        ]
    }
    
  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
    [Keyword validation failed: Data has additional properties (name) which are not allowed in model]",
    

    99% likely that this is fixed by 📌 Version component prop definitions for SDC and Code components Active per @larowlan at https://git.drupalcode.org/project/experience_builder/-/merge_requests/1...

  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    📌 Version component prop definitions for SDC and Code components Active is in, can you test my hunch in #4? 😇🙏

  • 🇪🇸Spain isholgueras

    Maybe it's because of my installation/branch, but in the branch 📌 [SPIKE] Prove that it's possible to apply block settings update paths to stored XB component trees Active , right after rebasing 0.x, I get the following error every time I place a block:

    	UnexpectedValueException: No component version specified. in Drupal\experience_builder\Form\ComponentInputsForm->buildForm() (line 72 of /var/www/html/web/modules/contrib/experience_builder/src/Form/ComponentInputsForm.php).
    

    I'll investigate a bit

  • 🇪🇸Spain isholgueras

    After investigating a bit, that's what I've found:

    The new code added in ComponentInputsForm.php

        $tree = $request->get('form_xb_tree');
        [$component_id, $version] = \explode('@', \json_decode($tree, TRUE)['type']);
        if (empty($version)) {
          throw new \UnexpectedValueException('No component version specified.');
        }
    

    Extracts the version, and if it's empty throw an exception.

    In my fresh installed Drupal with XB and xb_test_block, If I add the who_s_new I get the error.

    What is in tree is:

    {"slots":[],"nodeType":"component","type":"block.views_block.who_s_new-block_1","uuid":"4adc7962-290e-4bcf-81f7-798f275518ba"}
    

    and there is no such version

  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    #7: you need to reinstall XB and rebuild the UI. The version stuff was newly added last night in #3523841 😇

  • 🇪🇸Spain isholgueras

    Yep, I've updated again 0.x, reinstalled, rebuilt ui (I thought I did it because I have it in the same command to reinstall the site) and now looks good. I can add any block component, change any setting and the UI is automatically refreshed.

    It can be closed.

Production build 0.71.5 2024