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

  1. Insert a source with an #ajax element, such as the test_switch test source.
  2. Select a style in the Styles tab.
  3. 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.

CommentFileSizeAuthor
#5 3635019 after.png821.39 KBcsakiistvan
#5 3635019 before.png900.13 KBcsakiistvan
Command icon 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

mogtofu33 created an issue. See original summary.

mogtofu33’s picture

Status: Active » Needs review
csakiistvan’s picture

Assigned: Unassigned » csakiistvan
csakiistvan’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new900.13 KB
new821.39 KB

✅ Tested and works — applied MR !542, rebuilt caches, inserted a test_switch source in a page layout builder, saved a style in the Styles tab, then changed the Type select in the Config tab: the ajax_form=1 POST now goes to the node route and returns 200, where before the fix it went to settings/styles?ajax_form=1, failed with "Oops, something went wrong" and logged a MethodNotAllowedHttpException. 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).

csakiistvan’s picture

Assigned: csakiistvan » Unassigned

  • mogtofu33 committed dc597598 on 1.0.x
    fix: #3635019 Config panel #ajax requests post to the route of another...
mogtofu33’s picture

Status: Reviewed & tested by the community » Fixed

Thanks.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

pdureau’s picture

Status: Fixed » Closed (fixed)

Shipped in beta10 release.