Problem/Motivation
Core sends an #ajax element's request to the route that rendered its form.
A Styles, Visibility, paste styles or delete styles update renders the Config panel again in its own response.
The next #ajax request in Config, such as a source switch or a prop Edit button, then goes to that route.
The Styles and Visibility route only accepts PUT, and core AJAX uses POST.
Nothing tests the Config panel with real field sources, or with AJAX clicks followed by a save.
Steps to reproduce
- Insert a source with an
#ajaxelement, such as thetest_switchtest source. - Select a style in the Styles tab.
- In the Config tab, change the select: the request goes to
/_node/{node_id}/settings/styles?ajax_form=1.
Proposed resolution
Point the #ajax URLs of the Config form at the node update route after the build.
Setting the URL before the build would turn on the form cache, which brings back the stale form state of #3623715: Island forms share one form id and load each other's cached state.
Add a kernel harness that drives the panel the way a browser does. Cover field formatters, the component formatter, entity references, slot rows, and Edit, Save and Cancel.
Remaining tasks
Review.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 3635019 after.png | 821.39 KB | csakiistvan |
| #5 | 3635019 before.png | 900.13 KB | csakiistvan |
Issue fork display_builder-3635019
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
mogtofu33 commentedComment #4
csakiistvanComment #5
csakiistvan✅ Tested and works — applied MR !542, rebuilt caches, inserted a
test_switchsource in a page layout builder, saved a style in the Styles tab, then changed the Type select in the Config tab: theajax_form=1POST now goes to the node route and returns 200, where before the fix it went tosettings/styles?ajax_form=1, failed with "Oops, something went wrong" and logged aMethodNotAllowedHttpException. The Config panel AJAX is answered after a Styles save.Code review: The kernel harness always sends to
display_builder.api_update(callUpdate()), so only the new Playwright test covers the Styles-route rewrite (non-blocking).Comment #6
csakiistvanComment #8
mogtofu33 commentedThanks.
Comment #10
pdureau commentedShipped in beta10 release.