Closed (fixed)
Project:
Experience Builder
Version:
0.x-dev
Component:
Theme builder
Priority:
Major
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
20 Feb 2025 at 03:21 UTC
Updated:
18 Mar 2025 at 10:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
wim leersThis is incomplete because it still allows
type: objectwith arbitrary other values to be specified. IOW: more validation logic is needed.But … this should allow the FE work to begin right now:
Comment #3
wim leers(#3499927: Config entity for storing code components heavily restricted what props you're allowed to use. My initial thinking: add a validation constraint that checks that the user-specified prop for the code component results in a non-
NULLreturn value from\Drupal\experience_builder\JsonSchemaInterpreter\SdcPropJsonSchemaType::computeStorablePropShape().)Comment #4
lauriiiCross referencing an issue to add support for textarea in the code editor which is likely very similar to this.
Comment #5
wim leersThat's right: #3507928-2: [Front-end] Allow adding "textarea" props in the code component editor.
Comment #6
wim leersWhat's not yet explained in #2, is the explicit validation.
We'll need to add a new validation constraint:
This then receives every key-value pair under
props, so something like(this is the example in
\Drupal\Tests\experience_builder\Kernel\Config\JavaScriptComponentValidationTest::setUp()).The validation constraint's validator then should do something like:
Comment #7
wim leersNeeds explicit test coverage, probably just a new case in
\Drupal\Tests\experience_builder\Kernel\Config\JavaScriptComponentValidationTest::providerTestEntityShapes()?Blocks #3507928, see #3507928-3: [Front-end] Allow adding "textarea" props in the code component editor.
Once the BE MR is in, the FE work can begin, after which a screenshot (or better yet: a screencast) is expected.
Comment #8
wim leersComment #9
wim leersComment #10
wim leersComment #13
wim leersTests are present 👍 CI results look promising. MR looks great, only nits! 😄
Comment #14
f.mazeikis commentedAddressed nits, updated one failing test, waiting on CI.
Comment #15
wim leersJust one last suggestion on the MR, but this is good to go!
Comment #16
f.mazeikis commentedImplemented the last suggestion, addressed failing CI on ESlint and merged.
Comment #17
wim leersNow ready for the front-end part!
Comment #18
wim leersComment #19
wim leers@f.mazeikis We forgot to update
openapi.ymland expand\Drupal\Tests\experience_builder\Functional\XbConfigEntityHttpApiTest::testJavaScriptComponent()to test either what this MR landed, or what #3507928: [Front-end] Allow adding "textarea" props in the code component editor's back-end MR landed.I vote explicitly testing
type: object, $ref: json-schema-definitions://experience_builder.module/imagein the internal HTTP API integration test.Comment #21
wim leersLooks like the
components.schemas.CodeComponentinopenapi.ymlis not very precise currently (and it can't be due to #3503377: CI: introduce a nightly-only `slow-motion cypress E2E` CI job to auto-detect response latency-sensitive tests) and thanks to that, it looks like this wouldn't fail tests.P.S.: it's thanks to @tedbow's work on #3509026: JavaScript code components slots' examples and description should be optional that I even realized #19, so crediting him for that 😄
Comment #22
wim leersComment #25
wim leers@balintbrews was hitting
Analyzed it. Conclusion:
$default_resolved_valueis computed correctly, and is set to the absolute image URL that was specified as the default::getClientSideInfo()doesn’t yet pass that to the client, that’s up to #3493943: SDC+JS Component Sources: split default values into `resolved` and `source` to do! 😬UrlPreviewPropSourcefallback case inGeneratedFieldExplicitInputUxComponentSourceBase::clientModelToInput()… but that is designed to only be created when there’s a need for actual rewritingJsComponent::rewriteExampleUrl()with a @todo pointing to #3493943Comment #27
wim leersDone. This is the very first code component containing an image ever rendered — forgive the ugliness of my test content 🤣

I'll let @balintbrews record a magnificent screencast instead 😇😜
P.S.: all of this is only possible thanks to the work @longwave and I did on #3501902: Adding the Image component results in a state considered invalid 🥳
P.P.S.: @longwave +1'd #25's approach — crediting him.
Comment #29
balintbrewsComment #30
lauriii#27 😱😱😱🎉🎉🎉👏👏👏
Comment #31
wim leersComment #33
wim leersComment #34
wim leersBoth pieces are in :)
Comment #35
balintbrewsComment #36
nagwani commentedComment #37
nagwani commented