From 9365d1b1155f72d216cb8de01e0e55e722dae88f Mon Sep 17 00:00:00 2001 From: Joel Drapper Date: Tue, 26 Nov 2024 14:30:21 +0000 Subject: [PATCH] fixup --- lib/phlex.rb | 1 - lib/phlex/sgml.rb | 8 +++----- quickdraw/kit.test.rb | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/phlex.rb b/lib/phlex.rb index 29b931a5..e733b7ec 100644 --- a/lib/phlex.rb +++ b/lib/phlex.rb @@ -22,7 +22,6 @@ module Phlex Escape = ERB::Escape ATTRIBUTE_CACHE = FIFO.new - SUPPORTS_FIBER_STORAGE = RUBY_ENGINE == "ruby" Null = Object.new.freeze CACHED_FILES = Set.new diff --git a/lib/phlex/sgml.rb b/lib/phlex/sgml.rb index 46f810c2..71a93d5d 100644 --- a/lib/phlex/sgml.rb +++ b/lib/phlex/sgml.rb @@ -70,8 +70,8 @@ def call(buffer = +"", context: {}, view_context: nil, parent: nil, fragments: n return "" unless render? - if !parent && Phlex::SUPPORTS_FIBER_STORAGE - original_fiber_storage = Thread.current[:__phlex_component__] + unless parent + original_component = Thread.current[:__phlex_component__] Thread.current[:__phlex_component__] = self end @@ -96,9 +96,7 @@ def call(buffer = +"", context: {}, view_context: nil, parent: nil, fragments: n end unless parent - if Phlex::SUPPORTS_FIBER_STORAGE - Thread.current[:__phlex_component__] = original_fiber_storage - end + Thread.current[:__phlex_component__] = original_component buffer << phlex_context.buffer end end diff --git a/quickdraw/kit.test.rb b/quickdraw/kit.test.rb index 599dc4cc..0cf5ae79 100644 --- a/quickdraw/kit.test.rb +++ b/quickdraw/kit.test.rb @@ -15,7 +15,7 @@ def view_template if Phlex::SUPPORTS_FIBER_STORAGE # this test is flaky test "raises when you try to render a component outside of a rendering context" do - expect { Components::SayHi() }.to_raise(RuntimeError) do |error| + expect { Components::SayHi("Joel") }.to_raise(RuntimeError) do |error| expect(error.message) == "You can't call `SayHi' outside of a Phlex rendering context." end end