Fix incorrect config collection processing order in 3.1.x#4264
Open
sentience wants to merge 4 commits into
Open
Fix incorrect config collection processing order in 3.1.x#4264sentience wants to merge 4 commits into
sentience wants to merge 4 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4182.
This fixes a regression in Eleventy 3.1.0 and later where a layout importing a user config collection via
eleventyImport.collectionscould render before that config collection had been built from its underlying tag collection.Here's a practical scenario where this broke my site in the upgrade from 3.0.x to 3.1.x:
eleventyImport.collections:primarycollection:Under the current scheduler, Eleventy correctly knows that the layout consumes
primaryNav, but it does not know thatprimaryNavitself depends onprimary. As a result, the config collection can be evaluated too early and appear empty during layout rendering.Change
After
initDependencyMap(fullTemplateOrder)has populatedthis.collection, recompute any user-config collections present in the template order before resolving remaining computed data and rendering content.This restores the expected (pre-3.1.0) behavior for derived config collections without changing the dependency graph model.
Test
Adds a regression test covering:
eleventyImport.collectionsThe test fails without this patch and passes with it.