- Issue created by @finex
- Assigned to shailja179
- Status changed to Needs work
over 1 year ago 9:26am 22 May 2023 - 🇮🇹Italy finex
Hi, I've found the problem and created a patch. Let me know if it is ok to merge.
- Assigned to finex
- Status changed to Needs review
over 1 year ago 10:09am 22 May 2023 - Issue was unassigned.
- Status changed to Needs work
over 1 year ago 5:02am 23 May 2023 - Status changed to Needs review
over 1 year ago 5:03am 23 May 2023 - 🇮🇹Italy finex
Hi @shailja179, why did you hide my patch? Anyway, this is a more efficient patch.
- 🇮🇳India shailja179 India
@FiNeX,sorry it may be by mistake.I was reviewing your patch, may be accidentally. Sorry for that.
- 🇺🇸United States mtalt Maryland
@FiNeX - Thank you for the issue and patch.
The switch to using a combination of hook_entity_presave() and hook_entity_insert() instead of just hook_entity_presave was done in an attempt to solve for the link field issue you had reported in issue 3322934 🐛 WSOD saving node if "Links" field is enabled on view mode Fixed . The patch in #11 would revert that fix and cause the error when creating new nodes that display the links field.
But it does look like it was a mistake to attempt to workaround the issue by using hook_entity_insert() because you run into issues like yours with Webform when the entity is saved again. In order to attempt to solve for both the original links field issue and the improper use of hook_entity_insert(), I have updated the patch to include code to set the in_preview property for nodes to TRUE, which will prevent the links field links from being built.
Please review!
- 🇺🇦Ukraine gena.io
Hi everyone!
I would like to propose another logic in the following patch. It keeps the original logix with the entity saving but in another, appropriate place.
Check it out - 🇧🇪Belgium weseze
@mtalt: tried your patch and works for us. Don't known about the link field issue tough, since we are not using that kind of setup.
@gena.io (and also to the maintainer of this module): calling save() function on an entity in any of the insert/update/presave/postsave/... hooks should never be done. These hooks are called when drupal is already saving the entity, so you basically save it twice. That makes no sense and can lead to al sorts of issues with core/contrib (now and later on) Please don't go down that route...
- Assigned to mtalt
- Status changed to RTBC
about 1 year ago 6:10pm 25 September 2023 - 🇺🇸United States mtalt Maryland
@weseze Thank you for testing. Agreed that the code should never have been saving the entity in the presave or insert hooks. I'll get this into the dev branch.
- Status changed to Fixed
about 1 year ago 6:21pm 25 September 2023 Automatically closed - issue fixed for 2 weeks with no activity.