craft-preparse-field icon indicating copy to clipboard operation
craft-preparse-field copied to clipboard

Preparse Saved After Element Save Marks All Fields as Dirty

Open kevinamezaga opened this issue 2 years ago • 0 comments

Was having an issue with the preparser field that threw me for a loop.

I use the Preparse field to generate a number value of a total # of related entries to the entry being saved. By default, this saved after the entry was saved; that would normally be fine, however, I have a plugin that takes that entry, checks if a certain field is dirty, and if the new value is true, then it sends out notifications.

So I finally figured out that it was the Preparse field that, on the second save after the user saves the element, marks all the fields as dirty even though it's just the Preparse field that's dirty. This bypassed all of my plugin's logic. I ended up making the field save before the entry save, but I spent a fair amount of time troubleshooting before I got to this conclusion.

Some recommendations:

  • Set the default action to save before entry save
  • Change the plugin logic to only mark the preparse field as dirty

kevinamezaga avatar Oct 13 '21 18:10 kevinamezaga