-
-
Notifications
You must be signed in to change notification settings - Fork 632
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
Don't render empty unnecessary component closing comments #903
Comments
ComponentRepr
renders empty comments in release mode
Just so I understand the question and can answer more helpfully: What specifically are you concerned about here? Performance? Styling? Memory use? A user opening up the DOM inspector and seeing a bunch of comments? Something else? There are probably ways we can reduce this but it's likely removing the Generally speaking in release mode there's a closing comment which marks the boundary between two components; this is necessary for things like dynamic children, fragments, and Your image suggests to me you have a bunch of nested components that don't actually create HTML elements, but maybe I'm wrong. |
Thanks for the detailed explanation. A bit of everything, but I'm not really concerned about that, I suppose that is useful for components like
Some |
Yeah this all seems completely reasonable. I'll have to think about it a little more but I'm pretty sure we should be able to remove the redundant ones. Thanks for bringing this up. |
ComponentRepr
renders empty comments in release mode
Small update: This has been done in my early work on a new renderer for 0.6, which does not insert any marker nodes for types that return |
@reedwoodruff In 0.6, we can
We cannot remove every marking comment, because they are needed as placeholders for a certain set of dynamic elements unless me massively restrict the flexibility of the framework. |
Fair enough, I know that |
I guess I'll answer "sort of, but not really," and the same changes that close that will close this. On the specific question about sibling nodes/walking the DOM, I'd say assuming that there will never be any comment/placeholder nodes used by the framework will not be accurate, but the number of them will be greatly reduced, and the use of hydration IDs on elements (#972) will not be necessary any more. |
Done in 0.7. |
I'm seeing a lot of empty comments in the HTML of a webapp deployed on production.
Looking at the code I suspect that the closing comment of
ComponentRepr
should not be included in release builds, avoiding a lot of potential calls to insert nodes in the DOM. Are these comments neccessary for some reason?The text was updated successfully, but these errors were encountered: