From f637ba9366a768561a284d43ec01b10b396cec21 Mon Sep 17 00:00:00 2001 From: Blake Williams Date: Tue, 15 Feb 2022 13:36:08 -0500 Subject: [PATCH] Minor cleanup --- lib/view_component/base.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/view_component/base.rb b/lib/view_component/base.rb index 7589c3702..97ddd637f 100644 --- a/lib/view_component/base.rb +++ b/lib/view_component/base.rb @@ -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