Problem/Motivation

I ran a test upgrade to Drupal 11.3-beta and got this error when accessing the story pages:

An exception has been thrown during the compilation of a template ("You cannot enable the "use_yield" option of Twig as node "TwigStory  
  book\Twig\Node\StoriesNode" is not marked as ready for it; please make it ready and then flag it with the #[\Twig\Attribute\YieldReady]  
   attribute.")

It appears the dependent package https://github.com/e0ipso/twig-storybook is not Twig 4.x compatible.

Proposed resolution

Option #1
I was able to work around this by setting the `services.yml` file to use this variable:

parameters:
  twig.config:
    use_yield: false

We need a more permenant solution that allows twig to be used with use_yield: true

Option #2
Use the patch from Twig Storybook - Support Twig 4.x with YieldReady #18
Hoping for a quick review/merge then a quick fix release
Not sure if the library will need a new branch

CommentFileSizeAuthor
#8 storybook-disable-yield-3560490.patch963 bytesrjjakes

Comments

rjjakes created an issue. See original summary.

rajab natshah’s picture

Priority: Normal » Major

Facing the same issue

rajab natshah’s picture

Status: Active » Needs review

Tested the option, Not working, It will break the front-end theme.

Using the following patch from the pull request
Twig Storybook - Support Twig 4.x with YieldReady #18
as in https://patch-diff.githubusercontent.com/raw/e0ipso/twig-storybook/pull/18.diff
Having a local managed static patch as in

      "e0ipso/twig-storybook": {
        "Twig Storybook - Support Twig 4.x with YieldReady #18":
        "https://raw.githubusercontent.com/vardot/varbase-patches/refs/heads/patches/twig-storybook--2025-12-23--pr18.patch"
      },
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Issue summary: View changes
eelkeblok’s picture

I did not experience the frontend theme breaking, the patch seems to be working fine, although I did not look into whether it is technically correct. Could you elaborate how the frontend theme broke?

BTW, it is not a best practice to put the URL for a merge request directly into your local patches configuration. With composer patches 1.0, the code in your project may change along with the content of the merge request. I think with composer-patches 2.0 you no longer run that risk, but your build will break instead. Copy the contents of the URL into a local file.

rajab natshah’s picture

Status: Needs review » Reviewed & tested by the community
rjjakes’s picture

StatusFileSize
new963 bytes

Front end theme actually broke for me too, but was able to conditionally disable yield just for storybook with the attached patch.

rjjakes’s picture

Status: Reviewed & tested by the community » Needs work
rajab natshah’s picture