frctl / twig

Use Twig templates with Fractal.
32 stars 34 forks source link

Fix "Cannot read property 'request' of undefined" #22

Closed julkue closed 4 years ago

julkue commented 5 years ago

A "render" template like e.g.:

{% render "@utility-nav" %}
{% render "@header" %}

triggers the following error:

000016

The reason being that let request = env.request || this.context._request; is executed before the check of env.

mihkeleidast commented 5 years ago

Not sure about this. It will probably resolve the error, but that request variable should always be defined, otherwise the path filter will not output the expected result.

I've encountered this while using the only keyword on my includes, or when using multiple nested embed and include tags. This might also be related to an upstream twig.js bug: https://github.com/twigjs/twig.js/issues/287

mihkeleidast commented 4 years ago

This has been resolved in the meantime by #28