Open michielroding opened 8 months ago
Thanks for reporting that!
Just released Element API 4.1.0 with a fix for this. Now caches are no longer stored beyond the lowest expiry date from the results.
Sorry, just realized you are talking about post dates, not expiry dates. I’ll have to think a bit more on that one, as we don’t currently have any code in place for restricting cache durations based on post date.
Description
When an Entry has a postDate in the future (pending) the
\craft\base\Element::@$enabledForSite
is disabled.Once the postDate is in the past this (and other fields) becomes enabled, but the API will still return the old disabled value. Adding a random cache-busting query parameter to the API call will return the correct new state.
We use Craft as a headless CMS and want to be able to schedule articles in the future. However the cache isn't expired when the postDate is in the past.
Steps to reproduce
status
set to[Entry::STATUS_LIVE, Entry::STATUS_PENDING]
enabledForSite
state being falseenabledForSite
is still reported as falseAdditional info