@@ -19,9 +19,9 @@ def call(...)
1919
2020 # Create a new instance of the component.
2121 # @note The block will not be delegated {#initialize}. Instead, it will be sent to {#template} when rendering.
22- def new ( *, **, &block )
22+ def new ( *a , **k , &block )
2323 if block
24- object = super ( *, **, &nil )
24+ object = super ( *a , **k , &nil )
2525 object . instance_exec { @_content_block = block }
2626 object
2727 else
@@ -70,10 +70,7 @@ def call(buffer = +"", context: {}, view_context: nil, parent: nil, fragments: n
7070
7171 return "" unless render?
7272
73- if !parent && Phlex ::SUPPORTS_FIBER_STORAGE
74- original_fiber_storage = Fiber [ :__phlex_component__ ]
75- Fiber [ :__phlex_component__ ] = self
76- end
73+ Thread . current [ :__phlex_component__ ] = self
7774
7875 phlex_context . around_render do
7976 before_template ( &block )
@@ -96,11 +93,10 @@ def call(buffer = +"", context: {}, view_context: nil, parent: nil, fragments: n
9693 end
9794
9895 unless parent
99- if Phlex ::SUPPORTS_FIBER_STORAGE
100- Fiber [ :__phlex_component__ ] = original_fiber_storage
101- end
10296 buffer << phlex_context . buffer
10397 end
98+ ensure
99+ Thread . current [ :__phlex_component__ ] = parent
104100 end
105101
106102 protected def __context__ = @_context
@@ -287,13 +283,13 @@ def __yield_content_with_no_args__
287283 nil
288284 end
289285
290- def __yield_content_with_args__ ( *)
286+ def __yield_content_with_args__ ( *a )
291287 return unless block_given?
292288
293289 buffer = @_context . buffer
294290
295291 original_length = buffer . bytesize
296- content = yield ( *)
292+ content = yield ( *a )
297293 __implicit_output__ ( content ) if original_length == buffer . bytesize
298294
299295 nil
0 commit comments