I'm a bit confused here. `statusChanged` should in my mind indicate that the previous status and new status are different, they can be in any combination (was draft, is now published, vice versa or something else like was pending). If the status has changed at all, then we probably need to invalidate the cache.

However, we also need to invalidate the cache if the post is published, regardless of whether the status just changed or not, so I would expect this line to read

`if (post.statusChanged ||| post.status === 'published') {`