sensiolabs / StorybookBundle

MIT License
41 stars 5 forks source link

Component mock doesn't work anymore #41

Open svianney opened 3 weeks ago

svianney commented 3 weeks ago

Hi,

Ux Twig Component version went to 2.21.0 and this particular commit totally broke mock logic.

I've dig into it a bit and I don't think there is a quick fix for it. Do you think you got time to fix it ? Let me know I can help.

squrious commented 2 weeks ago

Hi @svianney, thank you for the issue and your investigation. I looked at the code and as you said, there is no easy way to fix this... I'll need some time to figure it out.

squrious commented 2 weeks ago

I might have found a way to handle this using a custom Twig node to mock the context on display. The downside is I can't use a dedicated Twig environment for Storybook anymore. Mocking will work again (and it's probably better this way) but it breaks isolation. I try to make both possible.

svianney commented 2 weeks ago

That's interesting, I'm not really sure about what you have in mind but that's probably better than what I had in mind.

I was thinking that you would have to listen to PreCreateForRenderEvent and handle the rendering yourself but that seemed like an heavy solution and I don't like the fact that it means you won't be able to benefit from ComponentRenderer updates anymore.