Skip to content

Don’t preload defined Twig globals when preloading singles#15468

Merged
brandonkelly merged 2 commits intocraftcms:4.11from
bencroker:patch-64
Aug 3, 2024
Merged

Don’t preload defined Twig globals when preloading singles#15468
brandonkelly merged 2 commits intocraftcms:4.11from
bencroker:patch-64

Conversation

@bencroker
Copy link
Copy Markdown
Contributor

This PR ignores handles that are defined Twig globals when preloading singles as fallback values. Without this, Craft::$app->getEntries()->getSingleEntriesByHandle() is unnecessarily called on values such as craft, currentSite, currentUser, etc. This is a micro optimisation but feels like a better way of loading fallbacks.

If merged, this should be carried over to the 5.x branch as well.

@brandonkelly brandonkelly changed the base branch from 4.x to 4.11 August 3, 2024 13:50
@brandonkelly brandonkelly merged commit 6745ffb into craftcms:4.11 Aug 3, 2024
@brandonkelly
Copy link
Copy Markdown
Member

Good call, thanks! merged for 4.11 and 5.3.

@bencroker bencroker deleted the patch-64 branch August 3, 2024 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants