From 1773773f1e36cc4a5cc9cd2af6bdd845e495c1f6 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Fri, 15 Dec 2023 15:50:21 +0100 Subject: [PATCH] Add improved conditional to fix override priority Since routes aren't discovered yet, we need to check the pages directly --- .../Features/Documentation/DocumentationSearchPage.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/framework/src/Framework/Features/Documentation/DocumentationSearchPage.php b/packages/framework/src/Framework/Features/Documentation/DocumentationSearchPage.php index a27408c92fd..25f3d69de78 100644 --- a/packages/framework/src/Framework/Features/Documentation/DocumentationSearchPage.php +++ b/packages/framework/src/Framework/Features/Documentation/DocumentationSearchPage.php @@ -7,6 +7,7 @@ use Hyde\Hyde; use Hyde\Pages\InMemoryPage; use Hyde\Pages\DocumentationPage; +use Hyde\Pages\Concerns\HydePage; use Hyde\Framework\Actions\StaticPageBuilder; use Hyde\Facades\Config; @@ -43,7 +44,13 @@ public function __construct() public static function enabled(): bool { - return Config::getBool('docs.create_search_page', true) && ! Hyde::routes()->has(self::routeKey()); + return Config::getBool('docs.create_search_page', true) && ! static::anotherSearchPageExists(); + } + + protected static function anotherSearchPageExists(): bool + { + // Since routes aren't discovered yet, we need to check the pages directly + return Hyde::pages()->first(fn(HydePage $file): bool => $file->getRouteKey() === static::routeKey()) !== null; } protected static function routeKey(): string