In experimental modus: If you try to edit to many paragraphs at the same time it changes the published Status to unpublished.

Any ideas how to solve this problem?

CommentFileSizeAuthor
#3 Paragraphs_Issue.mp42.89 MBsistocarta

Issue fork paragraphs-3143256

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

nicolabelleri created an issue. See original summary.

berdir’s picture

Status: Active » Postponed (maintainer needs more info)

Never experienced that, need exact steps on how to reproduce this

sistocarta’s picture

StatusFileSize
new2.89 MB

I think the easiest way to show this issue ist in a Video.
Here how we get the Issue, that the paragraphs, after opening some, is unpublished.

sistocarta’s picture

Status: Postponed (maintainer needs more info) » Active
berdir’s picture

Ah, I see. I think there's an existing issue about the multiple clicks think, but that's just simply not supported. Drupal ajax doesn't support multiple parallel actions, you're guaranteed to get race conditions. The only thing I can think of would be to prevent doing that clientside, so not allow to click any further things as long as an ajax operation is pending.

berdir’s picture

Title: Paragraphs Experimental » Multiple parallel ajax operations result in race conditions/empty fields
cola’s picture

@berdir, did you have an example how to prevent "parallel actions" (clicks)?

er.garg.karan’s picture

I have fixed this via a custom code. Basically I am adding an overlay (the old css trick) that does not allow further action until current ajax request finishes.

// mymodule.module file

function my_module_page_attachments(array &$attachments) {
  $attachments['#attached']['library'][] = 'my_module/ajax';
}

// mymodule.libraries.yml file

ajax:
  css:
    theme:
      css/ajax.css: { }
  js:
    js/ajax.js:
      minified: true

// js/ajax.js file

/**
 * Overrider drupal default ajax behavior.
 */
(function ($, Drupal, drupalSettings) {
  Drupal.behaviors.myModuledminAjax = {
    attach: function (context, drupalSettings) {
      'use strict';
      /**
       * Theme override of the ajax progress indicator for full screen.
       *
       * @return {string}
       *   The HTML markup for the throbber.
       */
      Drupal.theme.ajaxProgressIndicatorFullscreen = () =>
        '<div class="ajax-progress-overlay"><div class="ajax-progress ajax-progress--fullscreen"><div class="ajax-progress__throbber ajax-progress__throbber--fullscreen">&nbsp;</div></div></div>';
    }
  };
})(jQuery, Drupal, drupalSettings);

// css/ajax.css file
.ajax-progress-overlay{position:fixed;z-index:1000;top:0;width:100%;height:100%;background:rgba(0,0,0,.4)}

bdunphy’s picture

I have been able to reproduce this consistently on sites. It is a timing issue where rapid fire clicks can cause the issue to trigger. For us, we have users who have lost content on a node from this bug. Paragraphs dissapear and they have to reload the page and all previous edits lost. I'm testing some code now in the hopes this will resolve the issue. I'll post once testing is completed. I should note that I'm testing against 8.x-1.16 and will look to upgrade to the latest release and then test again. This bug does exist and causes issues for users.

bdunphy’s picture

Status: Active » Needs review

I neglected to change the status in my work here. I have opened a Merge Request as seen in #11. This needs review and testing. I have tested against multiple releases of Paragraphs including 1.20.

yashaswi18’s picture

Status: Needs review » Needs work
bdunphy’s picture

@yashaswi18 - appreciate the code review. I'm testing now to ensure that the changes will not cause any issues. I'll update after testing.

bdunphy’s picture

Status: Needs work » Needs review

Committed changes as recommended.