Hi,

I recently mistakenly reported an error, but today it seems I really found a bug.

I have a paragraph type with a simple text box. When I add this to a section, everything works fine. But if I want to change or update the text later again, these changes will not be applied. Even after saving the node and re-editing it does not work.
I have now tested this with a fresh Drupal installation and only with the necessary modules active. But even there nothing is updated.

All modules are in the current dev version installed.

Any ideas?

Thanks in advance and greetings,
Florian

Comments

florianboehme created an issue. See original summary.

saschaeggi’s picture

Category: Support request » Bug report

I've recently came across the same issue but now it works again at least for me. So I think this is definitely a bug.

florianboehme’s picture

Hi Sascha,

thank you for your answer.

What did you do to make it work again?

florianboehme’s picture

Issue summary: View changes
simoneb’s picture

I've the same issue also. I can create new paragraphs but not editing them.
As soon as the page is saved all is reverted to the previous version

saschaeggi’s picture

this somehow fixed the problem for me, but I'm not sure if it will solve it for you, too:

Using ERL 1.x-dev with the following two patches:

"drupal/entity_reference_layout": {
                "ERL Paragraph Labels": "https://www.drupal.org/files/issues/2019-10-10/entity_reference_layout-provide_label_of_paragraph-3086548-6.patch",
                "ERL Replicate support": "https://www.drupal.org/files/issues/2019-10-04/3084642-erl_add_replicate_support-4.patch"
            }

Maybe worth a try.

simoneb’s picture

tried but not worked :(

florianboehme’s picture

I tried too, but it did not work that way either.

waluigi’s picture

I tested it with the newest version and was not able to reproduce the error. Therefore, I think this issue was fixed. Can anyone else approve this?

florianboehme’s picture

Unfortunately still does not work for me. neither 8.x-1.x-dev nor 8.x-1.0-alpha3

nicolash’s picture

Using 1.x-dev, I still get this. Glad I caught it early in a project. I guess there must still be some common scenario that doesn't make it update for people here, as it seems to work for others or this issue would be getting more attention.

saschaeggi’s picture

Maybe this issue is related to the one I've created & patched. Please try my patch from #3100630: Multiple ERL fields on one node don't work well together

breezeweb’s picture

I'm experiencing this bug as well.
Hi @saschaeggi I tried your patch but I still have the issue as well.

saschaeggi’s picture

@breezeweb can you check the console for JS errors?

breezeweb’s picture

StatusFileSize
new187.18 KB

@saschaeggi I receive the following error in the console, I'm not sure if it's related or not. I get this error immediately after the the paragraph edit modal is closed (after saving, or cancelling).

I'd also like to add that it might not be a ERL issue, I just tested out Classy Paragraphs and appear to have the same issue. The class will apply when it is initially created, but the value doesn't save when updating the content after the fact.

breezeweb’s picture

StatusFileSize
new111.85 KB
breezeweb’s picture

Just an update - It's happening with any field that you add to the ERL "Section".
It seems ERL will set it initially, but will ignore the change when you come back and update the field after it being initially published.

aimevp’s picture

Component: User interface » Code
Priority: Normal » Major

I have the issue as well and find this imho a rather critical or at least major bug.
What I've noticed as well is that the module does pick up layout changes. When I create a new section or move a paragraph to another section those changes do get picked up and saved. So the issue is only concentrated around the content of the paragraphs themselves.
I will try to further look for clues to what is going wrong.

aimevp’s picture

I have found what is causing the issue and breezeweb was wright with his suspicion in #15 this might not be the module's doing.
I got everything working again the moment I enabled the option "Create new revision" on my content type.

After reading breezeweb's comment I started searching in the issue queues of other modules (paragraphs, entity reference revisions) if I couldn't find a related issue and found this one: #3098924: referencedEntities() causes data loss. Sadly there isn't any patch yet but at least with revisions enabled we can continue using the module for now.

breezeweb’s picture

@aimevp
Funny enough, you beat me by 3 days. I meant to update everyone at the beginning of the week, but haven't had a chance yet.
I can confirm that it's the revision setting on the node.
I discovered the fix because I got the field working on a brand new content type, it took forever for it to click that the revision settings might be the problem.

nagy.balint’s picture

Interestingly we couldnt reproduce the issue even if we turned off revisions on the node.
Maybe something is still in the background and not only the revision is the problem.

tneitsch’s picture

I can reproduce this problem when trying to edit and save any entity that uses ERL when a) a new revision is unchecked or b) when there are no revisions at all like taxonomy terms

When revisions for an entity type are enabled and a new revision is created in this entity everything works fine with ERL.

j.’s picture

I am also having this issue (with either ERL 8.x-1.x-dev or 8.x-1.0-alpha3) when using ERL with Commerce 2.17 product types, which currently aren't able to use revisioning yet from my understanding.

itamair’s picture

I checked and my experience/ use case on this is the follow (both ERL 1.x-alpha3 and 1.x-dev):

  • If my host Entity (Node) has Revisions turned on, updates/changes to its Paragraphs (in ERL field) are properly stored & applied (also as a new revision in the db);
  • If my host Entity (Node) has Revisions turned off, updates/changes to its Paragraphs (in ERL field) are NOT properly stored & applied (revisions are of course not updated, and neither the data in db is updated;)

I checked if this might be a normal Paragraphs issue (we never know) and actually it is not. Indeed seems to be (it is) an ERL module issues.

My feeling is that ERL widget updating system/code tries to update inner entities (paragraphs) on the basis of a new revision in the host entity, that of course cannot find because it is not created ... sort of.

ERL widget updating system/code should be better inspected and fixed on this, I guess ...

itamair’s picture

I studied this further, and it's a good suggestion to report that this bug was present (I found it rolling) in the Alpha2 version ...

justin2pin’s picture

Status: Active » Needs review
StatusFileSize
new860 bytes

Digging into the widget code a little further and comparing it to the ParagraphsWidget, it looks like we need to flag paragraphs to be saved and set target ids in massageFormValues(). Patch attached.

itamair’s picture

Title: Paragraphs can not be updated in layout » Layout Paragraphs cannot be updated, when Host Entity Revisions disabled.
itamair’s picture

Status: Needs review » Reviewed & tested by the community

Cool. Thanks Justin!! I tested the #26 patch (with different use cases) and indeed it is working fine for me.
But I am refactoring it better, as the "setNeedsSave" should better checked to apply to a \Drupal\paragraphs\Entity\Paragraph entity.

itamair’s picture

Status: Reviewed & tested by the community » Needs work
itamair’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new1.44 KB

The new attached patch enhances the #26 with a better check to the proper application of the "setNeedsSave" method, that belongs to the EntityNeedsSaveTrait, included in the Drupal\paragraphs\Entity\Paragraph entity.
This patch also better match what is being patched on the open translations issue.
I tested it, and works fine (as the #26) as the $item is passed as reference ...

Green flag for committing this into dev (IMO).

  • itamair authored d60d9fd on 8.x-1.x
    Issue #3086805 by itamair, justin2pin, breezeweb: Layout Paragraphs...
justin2pin’s picture

Status: Reviewed & tested by the community » Fixed

Great, thanks all! Closing this one as fixed.

j.’s picture

Thank you. This has helped with my issue using Commerce 2.17 product types with ERL.

j.’s picture

Perhaps i spoke too soon. I'm on the latest dev and running into this error when i come back to edit a Commerce product entity that has ERL that already has sections with content. I can't "add another section" and when i click the 'Plus' button i get this in the browser console. Wondering if there is still some revisioning issues going on with custom entities?

erl-widget.js?q992ek:206 Uncaught TypeError: Cannot read property 'offset' of undefined
at positionMenu (erl-widget.js?q992ek:206)
at erl-widget.js?q992ek:269

itamair’s picture

I tested here, some further, with the really last dev, both with revisions switched on and off ... and everything works as expected (add and edit Layout and Paragraphs/Items).
Let's keep in mind that the module is still in Alpha3 state, and dev is a very evolving branch. So it is of course not usable in production.
Every finding here should be finalised to identify and fix existing bugs. But everything reported needs to be deeply tested and documented ... to be help how to exactly reproduce and identify the bug (and be sure to have cleared all you caches updating you branch ...).

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.