Closed (fixed)
Project:
Experience Builder
Version:
0.x-dev
Component:
Page builder
Priority:
Major
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
3 Oct 2024 at 14:53 UTC
Updated:
5 Mar 2025 at 13:10 UTC
Jump to comment: Most recent
Comments
Comment #3
tedbowThe current merge requests uses the preview API call same as #3478299: Implement basic auto-save
it currently does not work with components with a "name" property and it does not for images.
Comment #4
tedbowNow I have images working. It is just a POC so just assumes we are using media entities and the src always matches a file which then matches and a media entity
Comment #5
tedbowChanging this issue to do that actual save via "Publish" as that is the first functionality we need to add.
#3478299: Implement basic auto-save was committed for auto-save to the tempstore
Comment #6
tedbowUntil #3473336: The UI only handles resolved props values, hence complex widgets do not show the current value in props form (e.g. image with Media Library Widget) we will not know the actual target id for media. I have search based on
srcbut this is not the best solutionComment #7
tedbowI think this is ready for review.
This is no longer a POC so changing the Priority
Comment #8
tedbowComment #12
wim leersVery much on the right track, but I think in the current state it'll be hard to evolve.
I left a bunch of suggestions that IMHO make this more approachable, and make it easier to iterate on in the future.
WDYT, @tedbow?
Comment #13
tedbowre #12 see MR comments
Also I removed the changes under /UI where I had added the button because there were merge conflicts. I just copied that JS from another issue. I think this issue could go in without any UI changes because we have the functional test. It is not ideal because we don't have a way make sure the test client data is correct but I think to be practical it is fine, we can then create a client-side follow-up issue to use the new endpoiont
Comment #14
tedbowI think the e2e failure was random🤞🏻
I talked with @f.mazeikis about this. He is working on #3479643: Introduce a `Pattern` config entity( I think that is the correct issue). He said he could use some of this work in the new trait. I think maybe also
\Drupal\experience_builder\Controller\ApiSaveController::clientModelToServerPropsthe functions it calls. So probably in his issue that could all be moved to the new trait(it is only needed in the controller in this issue)So I think it would be good to this issue in and do #3487381: Create exception class for invalid data from client in a follow-up. Could create other follow-ups if @wim leers sees the need
Comment #15
tedbowComment #17
tedbowComment #18
wim leersA thorough review round 🏓
I think there's some crucial bits that are too rough to get merged here:
POSTbut does not restrict the route to that and appears to support updating an entity. Suggested fixes on MR: rename route + controller to be about saving entity revisions, not entities, then it all makes sense.Comment #19
tedbowThere are now phpunit (next major) tests failing. But the fail the same way for me on 0.x locally after I pulled the latest 11.x changes. That last 0.x ci passed so maybe it is something in Core 11.x.. Will rerun 0.x
Comment #21
tedbowComment #22
wim leersSorry for frustrating you, @tedbow 😬 🙈
Given this is introducing a HTTP API route that accepts arbitrary inputs, we IMHO should not defer precise validation error messages for the UI to follow-up issues: this issue IMHO SHOULD provide the necessary infrastructure to enable folks working on the XB UI to work on validation errors at the same time as they work on saving — because they go hand-in-hand. Validation was already handled … but it was lacking the precision needed for the XB UI to provide a good UX.
@tedbow is right that this resulted in some scope creep. But that's only because I tried to accelerate getting this MR to the point where I am comfortable with it landing (thanks to it being sufficiently complete/not having many follow-ups). Ideally, the changes to
ValidComponentTreeConstraintValidatorwould have happened in a blocking issue/MR (commits https://git.drupalcode.org/project/experience_builder/-/merge_requests/3... + https://git.drupalcode.org/project/experience_builder/-/merge_requests/3...), but for the sake of speed/minimizing overhead, I am personally fine with the scope creep 😇In particular these two MR threads:
Comment #23
tedbowI think I need to review the changes @wim leers made then I will put back to RTBC
Comment #24
tedbowNeeds work for the 2 failing tests cases I added, @wim leers maybe you think we shouldn't cover the new cases because we can somewhat trust the client but I thought I would at least point them out.
Setting to needs work to either make the tests pass or remove the test cases.
@wim leers I assigned to the issue to you to review those not necessarily fix those.
I guess it is also needs review for my long comment here https://git.drupalcode.org/project/experience_builder/-/merge_requests/3... 😬
but like I said there maybe I just need to sleep on it to see the wisdom of the changes @wim leers made, I definitely been convinced before 😉. So i guess I am not asking for any changes right now unless @wim leers is blow away by arguments there(which I am not expecting). I just wrote out what I was thinking and will see if I feel the same tomorrow.
@wim leers ultimately you are the tech lead so if are already confident on the changes you made and don't buy my argument that it is more complicated and harder to understand then I have reviewed them I am fine with them technically, so I won't block or hold up commit on those. I would rather get this issue and move on to other issues.
Other than that I think the only outstanding problem is the failing test cases and if those are fixed or removed I think this issue is ready to be committed.
Comment #25
tedbowrenaming because no longer have the button.
It was in the MR previously but i remove because I kept having merge conflicts under `/ui`
If we want to could add that back.
Comment #26
wim leers👏
The two failing test cases are excellent additions! 👍 🙏
Correct me if I'm wrong: AFAICT those new test cases would also have failed before I started making significant changes, right? 🤔
Asymmetric validation of
layout/treevsmodel/props.I did already spot the validation asymmetry:
modelis validated, buttreeis not. That was a concern, but I didn't want to hold this back any longer because I believed the infrastructure now had the right shape.So if I was right, I should be able to:
Solution
Thankfully, that is the case:
::clientLayoutToServerTree()as I already added for::clientModelToServerProps()→ fixesadd a failing test case for missing componentadd failing test case for missing props— because in HEAD, it's been impossible to send such an invalid value, since this MR introduces the potential for arbitrary inputs, as I described on the MR yesterday: https://git.drupalcode.org/project/experience_builder/-/merge_requests/3.... That's why HEAD has\Drupal\experience_builder\Plugin\DataType\ComponentPropsValues::getComponentPropsSources()throwing an exception whentree+props(in the client-side data model:layout+model) are out of sync.catchinValidComponentTreeConstraintValidatorthat I just added in https://git.drupalcode.org/project/experience_builder/-/merge_requests/3...— which was written by yours truly to validate thattree+propstogether are valid 😊Conclusion
Overall, thanks to your two new failing test cases, the point I was making during my reviews has actually been confirmed 😅: any API interactions MUST maximally reuse the existing validation constraints.
Put differently: if any gaps are found in the validation, then we MUST NOT write additional logic for the one code path we're working on in an MR, but instead we MUST update the validation constraint validator itself, to ensure it runs always. That is how we achieve consistency across the entire codebase, and how the same concepts are treated the same everywhere, making the codebase easier to reason about.
Comment #27
wim leersOops, wrote my comment in the IS field 🤣🙈
Comment #29
wim leersCrediting @larowlan for his review on the MR, which I responded to — I agree.
Comment #30
tedbowI think this is ready.
Comment #31
wim leers— @tedbow at https://git.drupalcode.org/project/experience_builder/-/merge_requests/3...
Whew! 😮💨
Per #30, merging! But apparently this needs to pull in
origin/0.xfirst, so did that, eagerly awaiting test results 🤓Comment #33
wim leersMerged!
Next step: reroll #3487773, because this MR moved some code that that MR was going to remove — see #3487773-7: Get component name from components list not from the component's model. Un-RTBC'd that prioritize this (more complex) MR.