if (!$entity->isPublished()) {
return AccessResult::allowedIfHasPermission($account, 'view unpublished while entities');
}

This needs some cache dependency on the entity.

Comments

fago created an issue. See original summary.

fago’s picture

        return AccessResult::allowedIfHasPermission($account, 'view published while entities')
          ->addCacheableDependency($entity);

This should do it.

  • fago committed 7d9e50f on 8.x-1.x
    Issue #2858151 by fago: Access result caching misses the entity cache...
fago’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.