question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't render child components when using twig for both components and docs

See original GitHub issue

When using twig for both components and docs (fractal.components.engine(twigAdapter) and fractal.docs.engine(twigAdapter)), I can’t render child components anymore.

So I have components/a/a.twig, and components/b/b.twig with:

{% render "@a" %}

Visiting component B results in the following error:

Error: Error: Template @a not found
    at /path/to/node_modules/@frctl/twig/src/adapter.js:158:24
    at new Promise ()
    at TwigAdapter.render (/path/to/node_modules/@frctl/twig/src/adapter.js:140:16)
    at ComponentSource._renderVariant (/path/to/node_modules/@frctl/fractal/src/api/components/source.js:207:30)
    at _renderVariant.next ()
    at onFulfilled (/path/to/node_modules/co/index.js:65:19)
    at tryCatcher (/path/to/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/path/to/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/path/to/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/path/to/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/path/to/node_modules/bluebird/js/release/promise.js:729:18)
    at Promise._fulfill (/path/to/node_modules/bluebird/js/release/promise.js:673:18)
    at Promise._resolveCallback (/path/to/node_modules/bluebird/js/release/promise.js:466:57)
    at Promise._settlePromiseFromHandler (/path/to/node_modules/bluebird/js/release/promise.js:559:17)
    at Promise._settlePromise (/path/to/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/path/to/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/path/to/node_modules/bluebird/js/release/promise.js:729:18)
    at Promise._fulfill (/path/to/node_modules/bluebird/js/release/promise.js:673:18)
    at Promise._resolveCallback (/path/to/node_modules/bluebird/js/release/promise.js:466:57)
    at Promise._settlePromiseFromHandler (/path/to/node_modules/bluebird/js/release/promise.js:559:17)
    at Promise._settlePromise (/path/to/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/path/to/node_modules/bluebird/js/release/promise.js:649:10)

It works fine when not using twig as docs engine.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mihkeleidastcommented, May 18, 2022

we have adapter integration tests in the examples directory, would be good if all the different adapter examples would then have this example docs page and a test/assertion that they all render the same, or at least similar.

0reactions
danbrelliscommented, May 18, 2022

Thanks for the quick reply @mihkeleidast and I understand about #1167 . I can certainly to a reproduction repository, but am a bit lost when it comes to how to write a test for this. I’ll start a new issue with what I am able, if it’s out of scope I understand. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

php - You can not use the "render" method if the Templating ...
I have installed twig 2 because otherwise could not install twig-bundle - was gettig error. How to get rid of this error and...
Read more >
Creating and Using Templates (Symfony Docs)
Templates in Symfony are created with Twig: a flexible, fast, and secure template engine. ... Twig components are an alternative way to render...
Read more >
How do I use a custom twig template with a render element?
I am seeing my controller return the correct elements, however I am unable to see the twig template render with additional markup.
Read more >
Unify & simplify render & theme system: component-based ...
Allow render arrays to use components by using '#component' => 'something' ... Drupal 8 has made big steps forward: Twig, removal of most ......
Read more >
Emulating Components in Twig - DEV Community ‍ ‍
Using the "with only" feature, you can encapsulate your component so it won't implicitly receive any variables from the context in which it's ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found