-
-
Notifications
You must be signed in to change notification settings - Fork 96
Move capturing up to the state object #880
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
Conversation
def vanish(...) | ||
capture(...) | ||
nil | ||
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 think this is a reasonable simplification here. It allocates a string but I think it’s fine.
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.
Yeah I think so. The typical use case for vanish
is that you'd be calling it with a block that shouldn't contain any direct element calls. So the performance optimization of Phlex::Vanish
probably wasn't even being used much.
def buffer | ||
case @buffer | ||
when Proc | ||
@buffer.call | ||
else | ||
@buffer | ||
end | ||
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.
We never needed this.
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! capture
still maintains its same contract so this can be a non-breaking update 💪
<3 |
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