Concurrent ajax submits cause user data loss

Created on 24 November 2016, over 7 years ago
Updated 2 February 2024, 5 months ago

Problem/Motivation

Execute two ajax requests - the first one has a processing time of e.g. 5 seconds and the second one of 1 second.
What now happens is that the form is processed for the first and for the second request with the initially requested form, but the second request has to be processed with the form generated by the first request, otherwise the new form array and form state generated by the second request will not have the data from the first request and caching them will overwritte the first request which on submitting the form will result in user data loss.

Issue is the chaotic situation that arises on the frontend due to this bug. When the bug occurs, the entire paragraph or brick subform is replaced by unrelated fields. The potential loss in this case is not the saved data, but rather the contributed content.

The main concern discussed in the title and summary is related to the backend aspect of the problem, which should be addressed through validation.

Attaching a patch demonstrating the problem.

Proposed resolution

Subsequent ajax requests have to wait on the previous ones before executing - however we have to still offer the ability that ajax requests could be executed regardless if another ajax request is currently running or not, only ajax requests modifying the form/the form build id have to be put in a queue or something similiar.

We need to solve this both in FormBuilder (not allowing processing of the same form build id twice) on the server side and in ajax.js (wait submitting with the same form build id) on the client side.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Form 

Last updated about 1 hour ago

Created by

🇩🇪Germany hchonov 🇪🇺🇩🇪🇧🇬

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024