Implement a fix for the `<title>` tag when rehydration is enabled
See original GitHub issueI only have a shallow understanding of this issue so anyone who can do it more justice please feel free to edit this description 👍
As was reported in https://github.com/glimmerjs/glimmer-vm/issues/796 there have been some issues where Fastboot has been adding comment nodes to track rehydration to the <title>
tag but because the browser does not “interpret” any html contained in the <title>
tag, the full text of the comments will be output in the browser’s title. This will then immediately flash when Ember boots and the comments are removed.
As this is quite a high impact issue and it is likely to affect quite a few people who intend to use Fastboot in production we need to come up with a solution that is workable for everyone.
Current proposed potential solutions:
- Special-case the title tag and make Fastboot more smart about the rendering and rehydration of this one tag.
- Implement a linting system that warned about cases that would cause issues with the title tag
- Implement some sort of AST in the Fastboot engine that would be able to rewrite any problematic tags (like
<title>
) in a more effective way.
One thing to consider when implementing a solution to this issue: we need to not just make sure that the HTML that is “returned from the server” is correct, we also need to make sure that the rehydration code also knows how to deal with the special case when trying to update the DOM. For example, if we took a purely naive approach to this we might end up with duplicate <title>
tags, which would not give the desired behaviour because the second <title>
tag would not “win” over the first 👍
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:13 (12 by maintainers)
Top GitHub Comments
Btw. I also worked on an alternative, low-level solution (in
simple-html-tokenizer
andglimmer-vm
). It supports<title>
,<style>
, and<script>
.I gotta fix remaining minor issues, but seems to be working overall! I’ll share the results shortly. 🙂
Cross-posting for those not following the glimmer-vm issue: 😉 https://github.com/glimmerjs/glimmer-vm/issues/796#issuecomment-506818798