Skip to content

Commit

Permalink
Evaluate condition earlier
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Mar 22, 2024
1 parent 44b901e commit 2f8b7cc
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,15 @@ private function shouldIndexPageBeActive(string $group, HydePage $currentPage):
{
// Unless the index page has a specific group set, the first group in the sidebar should be open when visiting the index page.

if ($this->groupMatchesCurrentPageGroup($currentPage, $group)) {
return true;
}

if (filled($currentPage->navigationMenuGroup())) {
return false;
}

return ($group === $this->getItems()->firstOrFail()->getGroupKey()) || $this->groupMatchesCurrentPageGroup($currentPage, $group);
return $group === $this->getItems()->firstOrFail()->getGroupKey();
}

protected function groupMatchesCurrentPageGroup(HydePage $currentPage, string $group): bool
Expand Down

0 comments on commit 2f8b7cc

Please sign in to comment.