StaticRenderer in 2.3.0
Closed this issue · 4 comments
In 2.3.0 (48b98fb#diff-39b69414ad8ca37f14d248ccb3163359), StaticReactRenderer was introduced as a parameter in ReactRenderer… What does this change/do? We now have to pass an AbstractReactRenderer as well as a SaticreactRenderer (which implements AbstractReactRenderer), why not just keep it to one abstract renderer and keep the decision which one to use (Static, PhpExecJs, …) to whoever uses it?
You are right, I was having doubts with that PR for other reasons as well, and I ended up merging it. Let me find a compromise so the idea behind this feature can work without messing with what you comment.
I'll hold of making an issue in Alexandres repo then :)
I have reverted this change in the 2.x branch:
2.3.1 has the same API as the previous releases (basically forget about 2.3.0).
3.0 has temporary this static renderer (basically a cache), but I don't like the API so much so it will change hopefully soon.
I will try to work in a 4.0 which will implement caching of components with some refactoring of the Twig extension, without creating a new renderer, but having instead the renderer that is being used wrapped in a cache manager so we can cache components. It should be basically an extra option to pass to the twig tag, and if it is not passed everything should work as it was working before.
Now that I am aware of packages that are using ReactRenderer but not ReactBundle I will try to be more careful with API breaks ;)
Great to hear it, thx! I locked the version in my repo to the last working one, but I guess I can remove that now :)
Yes, I love the bundle and wanted to have a way to use it with craft too
As for caching, it might be a better option to cache the output of the renderer, that's what I am doing in my projects