You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
moduleTurboStreamTagPatchdefturbo_streamTurboStreamTagHelpers.new(self)end# The `turbo_stream` helper provided by `turbo-rails` uses ActionView's `capture`# in a way that's incompatible with ViewComponent and leads to strange duplicated output.# These patches restore the behaviour without us needing to change how we call the original helpers,# but their behaviour doesn't exactly match them.# https://github.com/ViewComponent/view_component/issues/1137# https://viewcomponent.org/known_issues.html#turbo_frame_tag-double-rendering-or-scrambled-html-structureclassTurboStreamTagHelpersdefinitialize(component)@component=componentenddefreplace(target,_content=nil, **_rendering, &block)content=@component.capture(&block)tag.turbo_stream(action: :replace,target:){content}enddefupdate(target,_content=nil, **_rendering, &block)content=@component.capture(&block)tag.turbo_stream(action: :update,target:){content}end# ...more for other tag helper methods if necessary.delegate:tag,to: :@componentendend
Including this patch on a component means you can call turbo_stream and have it render as we intend without the need for the capture compatibility patch.
It'd be helpful to investigate whether we can do something that reflects that within turbo-rails to remove the dependency on the capture compatibility patch.
The text was updated successfully, but these errors were encountered:
Reflects ViewComponent/view_component#1137.
ViewComponent provides a capture compatibility patch, which patches Action View for compatibility with some helpers. Enabling this patch is necessary for the
turbo_stream
helper to work, but we don't want to recommend that ViewComponent users enable it unless they really must. Earlier, I was able to write a patch that roughly reflected the helper for my needs:Including this patch on a component means you can call
turbo_stream
and have it render as we intend without the need for the capture compatibility patch.It'd be helpful to investigate whether we can do something that reflects that within
turbo-rails
to remove the dependency on the capture compatibility patch.The text was updated successfully, but these errors were encountered: