komposable/komponent

Komponent's view_renderer is leaking to Rails

Closed this issue · 7 comments

This commit seems to have introduce a bug in Rails 5.2 support (and certainly more versions) :

3aed172#diff-d662fd06dc2cbab92ab384c4af54a041L12-R12

It happens that @view_renderer == controller.view_context.view_renderer is now true, which means komponent is leaking its view_renderer manipulation to Rails.

It prevents using both komponent rendering and standard Rails rendering.

Spone commented

@robink can you write a failing test case for this?

I think I could indeed ! Just let me a couple of days to find some time to work on it

Here you go ;-)

Spone commented

Thanks a lot @robink for contributing these tests. They seem to pass on the Rails 6 environment! We have to investigate how to fix this.

Well I guess the fix is quite easy if you look at the commit that introduced the bug (cf start of this thread). I'm ok to do it if you want (next week).

Spone commented

Yes I guess we have to do @view_renderer = @context.view_renderer.dup

It would be great if you had the time to try this fix and add it to your PR!

Spone commented

Fixed in #146