Starcounter / starcounter-include

Custom Element to include HTML partials/templates from Starcounter
MIT License
0 stars 0 forks source link

Cache <style> tags for better perf and fix FOUC #97

Closed alshakero closed 6 years ago

alshakero commented 6 years ago

My gut feeling is that it's a tad intrusive. But I don't have a solid argument against it. It makes more sense to me than issuing a network request for same the uniform.css file with every navigation.

Fixes: https://github.com/Starcounter/starcounter-include/issues/93

alshakero commented 6 years ago

The failure on Safari isn't related to my change and I'm working on fixing it. So feel free to review.

alshakero commented 6 years ago

@warpech I managed to fix Edge issue in Uniform. This fixes it too.

warpech commented 6 years ago

Normally caching of the stylesheet should be solved by link rel="preload", by that works only in Chrome.

Maybe it is actually smart to polyfill link rel="preload", but I think that @tomalec will really dislike replacing <link href=""> with an inlined <style>. Maybe for non-Chrome browsers we could actually accept that?

Let's put this review on pause until @tomalec is back from vacation. This PR is one of three proposed solutions for #93.

tomalec commented 6 years ago

I think it may become a non-GC-able, black hole, as user agent navigates through many nested partials.

We should at least remove styles from the Map when the partial view containing the resource is removed/changed. However, it still won't cover resources requested or removed asynchronously.

I got the feeling that this is an attempt to do browser's job and reinvent the wheel. I'd rather go this part once all the other ideas fail.

alshakero commented 6 years ago

Closing as it's a bad idea.