Changing a prop value makes 3 calls to the server

Created on 11 June 2025, 12 days ago

Overview


I spotted that whenever a prop value is changed in the UI, it generates 3 separate PATCH requests to the server.

One PATCH request to http://xb.test/xb/api/v0/layout/xb_page/1 with a payload containing componentInstanceUuid, componentType and model.

Two further PATCH requests to http://xb.test/xb/api/v0/form/component-instance/xb_page/1. These are almost identical but the first of the two contains the value before the edit was made and the second contains the new value.

So in gif the value of Text was "Heading elmen" and I typed "t" - it made two requests - the first sent "Heading elmen", the second "Heading elment"

Proposed resolution

Can this be made more efficient? The PATCH that sends the value of the field before it has changed in particular seems redundant.

User interface changes

None.

πŸ› Bug report
Status

Active

Version

0.0

Component

Redux-integrated field widgets

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
  • First commit to issue fork.
  • Merge request !1129#3529616 reduce patch requests β†’ (Merged) created by bnjmnm
  • πŸ‡ΊπŸ‡ΈUnited States bnjmnm Ann Arbor, MI

    The two PATCH requests to component-instance is due to the endpoint set to forceRefresh: true, which was added to fix the issue of vanilla Drupal behaviors not re-running if a component form is revisited. (the most common symptom was leaving then re-loading a component with a media library widget would result in the widget JS not working)

    Setting forceRefresh: true provides a redux-cached version of the form until the new version is available, then the updated data (including selectors necessary for Drupal Ajax to work) replaces it.. Apparently this setting also makes additional, unnecessary requests. In the MR I updated the criteria to force a refresh if

    • The query string changed (which is very expected)
    • The last query string came from a different component.

    Some manual testing is needed to ensure there aren't scenarios where a re-opening of a props form doesn't force a refetch.

  • Pipeline finished with Skipped
    11 days ago
    #520544
  • πŸ‡¬πŸ‡§United Kingdom jessebaker
Production build 0.71.5 2024