emberjs / ember.js

Ember.js - A JavaScript framework for creating ambitious web applications
https://emberjs.com
MIT License
22.45k stars 4.21k forks source link

Rendering htmlSafe'd falsey value as first thing in root loading template causes entirety of loading template content to permanently displace/replace root app outlet. #16172

Closed kennethdavidbuck closed 6 years ago

kennethdavidbuck commented 6 years ago

Entering the root loading route on first load, where the loading template only renders an htmlSafe falsey value (undefined etc), results in the root application outlet being permanently rendered out of order with respect to adjacent dom. Please see the attached twiddle for a minimum recreation of the issue. Toggle between double stash and triple stash in the loading route to see the issue appear and disappear. The issue first results when I switch from 2.9.x to 2.10.x. The issue is still present in my 2.18.x app.

Twiddle: https://ember-twiddle.com/516a41613293d3dc55c31a06009a45f7?openFiles=templates.loading.hbs%2C

Update The issue is actually a little bit worse than I thought. It turns out that the loading template content is getting permanently rendered where the main application outlet should be. I have updated the twiddle to demonstrate this. You will see that the content placed after {{{foo}}} in the loading template ends up being permanently placed where the main application outlet should be.

rwjblue commented 6 years ago

Would you mind updating the demo to use 3.1? This may have been addressed by the glimmer-vm update...

kennethdavidbuck commented 6 years ago

Hi @rwjblue , I created a temporary repo with emberjs 3.1.0-beta.2 installed and the bug is still present. https://github.com/kennethdavidbuck/emberjs-issue-16172-recreate

screen shot 2018-02-24 at 10 34 00 am

rwjblue commented 6 years ago

Thank you! Sorry for the delays here. I’ll try to carve out some time to dig in and at least figure out where things are going wrong...

kennethdavidbuck commented 6 years ago

All good, and thanks! I just wrote a failing test as well. I'll push that up in the next couple minutes here.

mongoose700 commented 6 years ago

I ran into what's probably the same issue in a component: https://ember-twiddle.com/b132a59b1ec18c91c45547b395ba10d6

It will trigger only if the component is tagless, I have an HTML-safe empty string at the start of the template, and the component is used with a block that includes at least one newline.

mongoose700 commented 6 years ago

This issue also duplicates https://github.com/emberjs/ember.js/issues/14924

chancancode commented 6 years ago

Sorry it took so long, this is fixed in 3.4.3 (#17003)