vaersaagod/seomate

Using isNew property to check for newly created Element

Closed this issue · 1 comments

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

  • Craft CMS version: 3.7.14
  • SEOMate plugin version: 1.1.11
  • PHP version: 7.4.1
  • Database driver & version: MySQL 5.5.5

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.