Unable to add SDCs with slots to the page

Created on 8 January 2025, 3 months ago

Overview

Dragging on a component with slots immediately throws an error and the page is no longer useable/editable

Adding the component on fires a call to /api/preview/node/{id} which returns a 500 error "Cannot assign null to property Drupal\\experience_builder\\Plugin\\DataType\\ComponentTreeStructure::$tree of type array" which in turn pops up a modal error box in the UI which cannot be bypassed thus locking up the editor until you create a new node or discard the auto-save data.

πŸ› Bug report
Status

Active

Version

0.0

Component

Page builder

Created by

πŸ‡¬πŸ‡§United Kingdom jessebaker

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

Merge Requests

Comments & Activities

  • Issue created by @jessebaker
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    Working to reproduce.

  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    Works fine here on HEAD (5865071b7bf4ebcdddd6fd9f77dd6a5b045f22be): I added the SDC to a region and placed the Druplicon SDC in there:

    Can you please post precise steps to reproduce?

    (Alternatively, at least the last ~5 lines of the logged PHP stack trace, so I can narrow it down from the other direction.)

  • πŸ‡¬πŸ‡§United Kingdom jessebaker

    Steps to reproduce are as simple as:
    Create new node
    Enter XB
    Drag+drop the One column component into the Content region

    I've done a full reinstall, drush cr etc. Using Olivero with the XB Global Regions enabled in the theme settings.

    Full stack trace from logs is as follows:

    TypeError: Cannot assign null to property Drupal\experience_builder\Plugin\DataType\ComponentTreeStructure::$tree of type array in Drupal\experience_builder\Plugin\DataType\ComponentTreeStructure->setValue() (line 124 of /Users/jesse.baker/Sites/drupal11xb/web/modules/contrib/experience_builder/src/Plugin/DataType/ComponentTreeStructure.php).
    
    
    Backtrace	
    #0 /Users/jesse.baker/Sites/drupal11xb/web/core/lib/Drupal/Core/TypedData/TypedDataManager.php(216): Drupal\experience_builder\Plugin\DataType\ComponentTreeStructure->setValue('null', false)
    #1 /Users/jesse.baker/Sites/drupal11xb/web/core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php(123): Drupal\Core\TypedData\TypedDataManager->getPropertyInstance(Object(Drupal\experience_builder\Controller\HardcodedPropsComponentTreeItem), 'tree', 'null')
    #2 /Users/jesse.baker/Sites/drupal11xb/web/modules/contrib/experience_builder/src/Plugin/Field/FieldType/ComponentTreeItem.php(199): Drupal\Core\TypedData\Plugin\DataType\Map->get('tree')
    #3 /Users/jesse.baker/Sites/drupal11xb/web/core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php(135): Drupal\experience_builder\Plugin\Field\FieldType\ComponentTreeItem->onChange('tree', false)
    #4 /Users/jesse.baker/Sites/drupal11xb/web/modules/contrib/experience_builder/src/Plugin/Field/FieldType/ComponentTreeItem.php(222): Drupal\Core\TypedData\Plugin\DataType\Map->set('tree', 'null', false)
    #5 /Users/jesse.baker/Sites/drupal11xb/web/modules/contrib/experience_builder/src/Controller/ApiPreviewController.php(141): Drupal\experience_builder\Plugin\Field\FieldType\ComponentTreeItem->setValue(Array)
    #6 /Users/jesse.baker/Sites/drupal11xb/web/modules/contrib/experience_builder/src/Controller/ApiPreviewController.php(66): Drupal\experience_builder\Controller\ApiPreviewController->clientLayoutAndModelToXbField(Array, Array)
    #7 [internal function]: Drupal\experience_builder\Controller\ApiPreviewController->__invoke(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\node\Entity\Node))
    #8 /Users/jesse.baker/Sites/drupal11xb/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Object(Drupal\experience_builder\Controller\ApiPreviewController), Array)
    #9 /Users/jesse.baker/Sites/drupal11xb/web/core/lib/Drupal/Core/Render/Renderer.php(593): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #10 /Users/jesse.baker/Sites/drupal11xb/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
    #11 /Users/jesse.baker/Sites/drupal11xb/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Object(Drupal\experience_builder\Controller\ApiPreviewController), Array)
    #12 /Users/jesse.baker/Sites/drupal11xb/vendor/symfony/http-kernel/HttpKernel.php(183): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #13 /Users/jesse.baker/Sites/drupal11xb/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
    #14 /Users/jesse.baker/Sites/drupal11xb/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #15 /Users/jesse.baker/Sites/drupal11xb/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #16 /Users/jesse.baker/Sites/drupal11xb/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #17 /Users/jesse.baker/Sites/drupal11xb/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #18 /Users/jesse.baker/Sites/drupal11xb/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(116): Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #19 /Users/jesse.baker/Sites/drupal11xb/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(90): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #20 /Users/jesse.baker/Sites/drupal11xb/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #21 /Users/jesse.baker/Sites/drupal11xb/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #22 /Users/jesse.baker/Sites/drupal11xb/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #23 /Users/jesse.baker/Sites/drupal11xb/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #24 /Users/jesse.baker/Sites/drupal11xb/web/core/lib/Drupal/Core/DrupalKernel.php(709): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #25 /Users/jesse.baker/Sites/drupal11xb/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
    #26 {main}
    
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    Thanks, will try again!

  • First commit to issue fork.
  • Merge request !519Make validation optional. β†’ (Merged) created by longwave
  • πŸ‡¬πŸ‡§United Kingdom longwave UK

    My bad, this is an oversight in πŸ“Œ Throw exceptions instead of returning tuples for validation errors Active .

    Previously we would return the structured tree and try to store it, even if it was invalid, because we need to be able to preview it still. A mistake in that issue means we return NULL on an invalid tree instead.

    We can work around this by making the validation optional in the preview case, until πŸ“Œ Improve server-side error handling Active lands which there is already a @todo for.

  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    Looks good to me, nice one!

  • πŸ‡ΊπŸ‡ΈUnited States tedbow Ithaca, NY, USA

    Does this point to the fact that we don't have e2e test coverage for adding components that have slots?

    I guess we had it in ui/tests/e2e/components-slots.cy.js but decided to skip the test in πŸ› Allow dragging components to top/bottom of page and in between adjacent components with slots Fixed . We going to added it back in πŸ“Œ Write end-to-end test for dragging components into slots Postponed . I changed the issue to "major" because I think with any commit we could break "slots" functionality and won't know it

  • Pipeline finished with Skipped
    3 months ago
    #390357
  • πŸ‡ΊπŸ‡ΈUnited States tedbow Ithaca, NY, USA

    Tested it manually and it does fix the problem but we should try to get πŸ“Œ Write end-to-end test for dragging components into slots Postponed fixed

  • πŸ‡ΊπŸ‡ΈUnited States tedbow Ithaca, NY, USA
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024