Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldrapper committed Nov 26, 2024
1 parent 283001e commit 9365d1b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
1 change: 0 additions & 1 deletion lib/phlex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 3 additions & 5 deletions lib/phlex/sgml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion quickdraw/kit.test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9365d1b

Please sign in to comment.