-
-
Notifications
You must be signed in to change notification settings - Fork 495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for nested nunjucks async shortcodes #1749
Conversation
@@ -287,57 +287,68 @@ class Nunjucks extends TemplateEngine { | |||
var body = parser.parseUntilBlocks("end" + shortcodeName); | |||
parser.advanceAfterBlockEnd(); | |||
|
|||
if (isAsync) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I’m reading this right, this makes all Nunjucks paired shortcodes into Async shortcodes? Is this slower?
Thinking about it, this is probably an issue with Nunjucks itself |
I've created a failing test and submitted it to Nunjucks: mozilla/nunjucks#1363 |
Maybe related 11ty/eleventy-img#110 |
I’m interested in trying to fix this in Eleventy, if possible. I don’t think mozilla/nunjucks#1357 is going to be enough, in local testing. |
Filed #2108 which is now the home base issue for this PR, I think. |
This is a beautiful PR and I’m so sorry I slept on it for too long. It doesn’t quite complete #2108 but it takes us a step in the correct direction. As stated previously there may be some (as of now untested) performance drawback to making everything async but we need to err on the side of correctness over performance here. Shipping. |
This will ship with |
…sh between async and sync shortcodes in Nunjucks now, due to #1749.
For future me, note that the fix here was included in 1.0 stable but the async-everything approach was reverted in #2140. |
Nested async shortcodes would fail to correctly output content from the inner shortcode as eleventy wasn't waiting for the content to have processed before passing it to the parent.
The
body()
call takes a callback, which gets called when the passed content of a paired shortcode has finished rendering, both on async and sync templates.Fixes #1053