- Issue created by @Alina Basarabeanu
- Status changed to Needs review
4 months ago 1:41pm 5 September 2024 - First commit to issue fork.
- Merge request !22Issue #3472326 Unable to remove item at non-existing index. β (Open) created by vselivanov
- πΊπ¦Ukraine vselivanov Kyiv, Ukraine
This is definitely an issue.
But patch #2 works only if you need to remove 1 element.
removeItem() function reassign deltas and for the next elements it wonβt work.The solution should be similar to the jsonapi module from Core:
- Collect deltas to remove
- Remove them in the desc order.
I tested with the multiple field reference to the paragraphs.
I have 3 paragraphs with 2 unpublished:$items = [ 0 => 'paragraph-0-unpublished', 1 => 'paragraph-1', 2 => 'paragraph-2-unpublished', ];
Unpublished paragraphs are not shown in the $elements after viewElements() and should be removed from the $items
$elements = [ 1 => 'paragraph-1', ];
Created MR and added a patch.