-
-
Notifications
You must be signed in to change notification settings - Fork 50
Fix caching #279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix caching #279
Conversation
lib/phlex/rails/sgml/state.rb
Outdated
original_capturing = @capturing | ||
original_fragments = @fragments | ||
|
||
begin | ||
@capturing = true | ||
yield | ||
ensure | ||
@capturing = original_capturing | ||
@fragments = original_fragments | ||
capture_context.capture do | ||
yield | ||
ensure | ||
@capturing = original_capturing | ||
@fragments = original_fragments | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand what's going on with the @capturing
and @fragments
here. Are they expected to be mutated inside the yield
? Why are we saving their state and restoring it, but not (seemingly) making any changes to them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ops, I missed something. Let me fix this.
In order to fix yippee-fun/phlex-rails#276, we need to simplify the capturing interface so it can be swapped out. This PR removes the ability to capture into an arbitrary buffer. Instead, it depends on reading the new buffer from the state within a capture block. See yippee-fun/phlex-rails#279
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me!
🎉 🎉 🎉 |
Depends on yippee-fun/phlex#880