-
-
Notifications
You must be signed in to change notification settings - Fork 84
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
Remove inline content #765
Conversation
👍 Thanks for cooperation anyway |
@@ -32,21 +32,13 @@ def register_element(method_name, tag: method_name.name.tr("_", "-")) | |||
class_eval(<<-RUBY, __FILE__, __LINE__ + 1) | |||
# frozen_string_literal: true | |||
|
|||
def #{method_name}(content = Phlex::Null, **attributes) |
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.
You need to remove Phlex::Null
definition also :)
The problem is any kind of check we do in those generated methods can have such a significant impact on the overall performance because they’re hit so many times. I think there's a way you could patch it though so inline content still works. As a little proof of concept, you should be able to do something like this def div(content = nil, *, **)
if content
super(*, **) { plain(content) }
else
super
end
end You could iterate over |
Idea was to move check at top level |
I guess we could break up the code generation into small parts that each can be patched. I’m trying to avoid over-complicating things though as that file is already pretty messy. |
I’m really sorry @Xanderwot. We changed our minds about this.
There was some discussion about this feature here https://github.com/orgs/phlex-ruby/discussions/761. We also discovered it added a 16% performance overhead.
I really appreciate your contributions and I’m sorry this one didn’t make it.