vaersaagod / seomate

SEO, mate! It's important. That's why SEOMate provides the tools you need to craft all the meta tags, sitemaps and JSON-LD microdata you need - in one highly configurable, open and friendly package - with a super-light footprint.
MIT License
36 stars 8 forks source link

Using isNew property to check for newly created Element #56

Closed sijones-uk closed 3 years ago

sijones-uk commented 3 years ago

Description

Since Craft 3.7.5, the isNew property is no longer reliable when determining whether the entry is being saved for the first time. It is recommended to use the newly created (as of Craft 3.7.5) firstSave property instead.

Steps to reproduce

  1. Line 136 in the SEOMate class uses the isNew property to check if the Element is newly created

Additional info

mmikkel commented 3 years ago

No, the isNew property is still the appropriate one in this case. The firstSave property is true when an unpublished draft is converted to a real entry for the first time, and since the entry ID is consistent between unpublished drafts and “real” entries on Craft 3.7+, we definitely want to clear any caches at that point.