templating-resources
templating-resources copied to clipboard
Two views loading the same CSS resources results in no style being injected
I'm submitting a bug report
- Library Version: 1.0.rc
Please tell us about your environment:
- Operating System: Windows 10
- Node Version: 6.3.0
- NPM Version: 3.10.3
- JSPM OR Webpack AND Version webpack 2.1.0-beta.17
- Browser: all
- Language: TypeScript 2.0
Current behavior:
When two views request the same resource while loading the app, then the second view seems to assume that the resource has finished loading, and tries to add it (null) to DOM, and sets _alreadyGloballyInjected
to true
. Resulting in nothing added. (when the first request finishes loading, it first checks _alreadyGloballyInjected
, which is true, so it just bails)
finder.html:
<require from="./finder.css"></resource>
finder-results.html
<require from="./finder.css"></resource>
Expected/desired behavior:
I haven't been able to reproduce it yet in a less complex app, probably because the resources load instantly..
- What is the expected behavior?
The second view should wait for the resource to finish loading before trying to process it. Or it shouldn't try to process it at all, because the first view already is doing that.
My workaround:
css-resource.js:
function beforeCompile(content, resources, instruction) {
if (this.css === null) return;
does not seem to be the case anymore
https://gist.run/?id=b10cbbd39a47dc577bc1adf9ec75b3de
probably can be closed
@bigopon ^^