Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
BlakeWilliams committed Feb 15, 2022
1 parent d00575e commit f637ba9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/view_component/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,18 @@ def render_in(view_context, &block)
# TODO flag with initializer
if !self.__vc_original_view_context
view_context.output_buffer = ActionView::OutputBuffer.new if !view_context.output_buffer
self.__vc_original_view_context ||= view_context
if self.__vc_original_view_context.global_buffer_coordinator.nil?
coordinator = self.__vc_original_view_context.global_buffer_coordinator = GlobalBuffer::Coordinator.new
coordinator.subscribe(self.__vc_original_view_context)

if view_context.global_buffer_coordinator.nil?
coordinator = view_context.global_buffer_coordinator = GlobalBuffer::Coordinator.new
coordinator.subscribe(view_context)
end

self.__vc_original_view_context = view_context
end

@output_buffer = self.__vc_original_view_context.output_buffer
self.global_buffer_coordinator = self.__vc_original_view_context.global_buffer_coordinator
self.__vc_original_view_context.global_buffer_coordinator.subscribe(self)
self.global_buffer_coordinator.subscribe(self)

@lookup_context ||= view_context.lookup_context

Expand Down

0 comments on commit f637ba9

Please sign in to comment.