This issue only affects embedded views with AJAX enabled. Under certain circumstances, it's possible for the Node Bulk Operation checkbox associated with a row to be mapped to a different node than the one displayed. In other words, you're trying to delete five nodes, but a different set of five nodes get deleted instead.
The issue only occurs when:
- AJAX is enabled for the Views display
- The display is using Node Bulk Operations
- Either a sort or a filter action is performed on the field data being displayed
I experienced this issue when using a table as the format for my embedded display. The field data in the table columns did not get scrambled upon sorting or filtering and the checkboxes also did not appear to get associated with the wrong table row. In other words, I don't believe the issue was caused by a mistake in assigning relationships causing the action to be performed on a different row than I expected it to be. Everything is normal until you submit the Node Bulk Operation form. Something happens between the moment you submit and the action Plugin executes the action.
It appears as if the actions are being performed based on the expected row position of an entity instead of the actual entity. What I mean is that if I have 1000 items and I do an AJAX sort on the title, a different set of five titles will be at the top, but the action continues to be performed on the entities that initially occupied those top five positions. I can reproduce this most of the time, but not 100% of the time. Sometimes I can perform a combination of sorts and filters and get it to take action on a different set of five nodes (still the wrong ones), but usually there appears to be a relationship between a sort order that the bulk operation is following and the one that's actually on screen.
Unfortunately, I'm unable to reproduce this on a clean install so I can't provide steps to reproduce, but I'm reporting this anyway because the consequences are very severe and there's a definite culprit. It's AJAX. It may be related to some other AJAX specific issues affecting embedded views that I've documented here:
https://www.drupal.org/node/2844823
It all revolves around AJAX. If AJAX is disabled for the View display, all issues go away. With AJAX disabled, the exact same embedded view works flawlessly no matter how I sort or filter it. The bulk operations get performed on the correct nodes.
Comments
Comment #2
hyperlinkedComment #3
lendudeMoving to the right queue.
This sounds like a duplicate of #2846782: Bulk operation actions might not act on the selected items. If you feel this is addressing a different issue, please feel free to reopen this.
Comment #4
hyperlinkedIt might be a duplicate. They definitely seem related, but this one is slightly different. I'd bet that the root cause is the same so when #2846782 is resolved, this would also get resolved.
The difference between #2846782 and my report is that in #2846782, the index gets scrambled when new nodes are added while an admin user is in the middle of performing bulk actions and the index on screen no longer corresponds to the index that'll be acted upon.
In this one, using AJAX to sort or filter a table causes the index to lose integrity without there needing new content added while actions are being performed.
I'll make a comment over on the other issue just so they know about this one too. I can't say for sure that it is the same issue or not.
Comment #5
hyperlinkedThis issue was indeed the same issue as #2846782: Bulk operation actions might not act on the selected items. That issue was resolved and I tested against 8.3.x-dev HEAD and was able to perform AJAX sorting of the problematic table I described above and when I applied bulk actions, they were applied to the correct items.