Skip to content
This repository was archived by the owner on Jul 18, 2022. It is now read-only.

Commit 585d99f

Browse files
committed
Don’t process entries with no route
1 parent 2bc49b3 commit 585d99f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/Data.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace Aerni\DynamicCache;
44

5-
use Aerni\DynamicCache\Contracts\Data as DataContract;
6-
use Illuminate\Support\Collection;
75
use RecursiveArrayIterator;
6+
use Statamic\Facades\Entry;
87
use RecursiveIteratorIterator;
9-
use Statamic\Entries\Entry;
8+
use Illuminate\Support\Collection;
9+
use Aerni\DynamicCache\Contracts\Data as DataContract;
1010

1111
class Data implements DataContract
1212
{
@@ -43,6 +43,10 @@ public function getInvalidationRules(): Collection
4343
private function entriesToExcludeFromStaticCache(): Collection
4444
{
4545
return Entry::all()->map(function ($entry) {
46+
if (empty($entry->route())) {
47+
return false;
48+
}
49+
4650
if ($this->shouldExcludeEntryFromStaticCache($entry->values())) {
4751
return $entry;
4852
}
@@ -53,6 +57,10 @@ private function entriesToExcludeFromStaticCache(): Collection
5357
private function entriesToIncludeInInvalidationRules(): Collection
5458
{
5559
return Entry::all()->map(function ($entry) {
60+
if (empty($entry->route())) {
61+
return false;
62+
}
63+
5664
if (! $this->shouldExcludeEntryFromStaticCache($entry->values())) {
5765
return $entry;
5866
}

0 commit comments

Comments
 (0)