Closed craic closed 10 years ago
It is probably a result of heavy HTML Import caching. If you open the devtools and click on the gear icon to open settings, you can set 'Disable cache when devtools is open'. Then, with the devtools still open, refresh the page.
Is there a better answer to this question? I was seeing the same thing. It appeared that Chrome is using cached copies of <link rel="import" ...>
targets even when the resources have caching headers that indicate otherwise.
What's even more bizarre is when I hit this problem I'll go to the devtools -> sources and then open the problematic imported file in another tab. I'll force reload that tab and see the newest version of the source (and the <template>
was out of date). So the browser has a newer copy. At that point reloading the original file still doesn't see the change to the <template>
.
The request headers were:
Accept:*/*
Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:no-cache
Connection:keep-alive
Cookie:...
Host:localhost:8080
Origin:http://localhost:8080
Pragma:no-cache
Referer:http://localhost:8080/frontend/tag-list.html
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36
The response headers were:
Content-Length:277
Content-type:text/html
Date:Mon, 15 Dec 2014 02:06:22 GMT
Last-Modified:Sun, 14 Dec 2014 22:51:02 GMT
Server:SimpleHTTP/0.6 Python/2.7.8
Notably the Last-Modified
header is totally wrong! It's off by 4 hours. Note the difference between the Date
header and the Last-Modified
header. I just saved this file. So Chrome is probably ignoring the new content because it has a cached copy that's more recent?
Sounds like a bug in SimpleHTTPServer.
Hi All, I have the same problem.Somebody can me say, how to solve this?
And I have the same problem
The reason you're seeing this is because Chrome heavily caches HTML Imports (it's trying to do the right thing and give you a performant experience). The solution is to open the devtools and check the box which disables the cache while the devtools are open.
What about production environment? Adding version "?v=" in all Polymer HTML imports doesn't solve this.
Rob, it's true that disabling the cache in the devtools fix the caching problem. But what about production? The only way I found out so far is to vulcanize the whole thing. and adding a fake version to it. Is this the only solution?
Thanks
@mbergeron
Vulcanizing + versioning is a performant approach. If you don't want to Vulcanize, and especially if the majority of your app's usage will be HTTP2-enabled, you could always set up cache headers for your server like: Cache-Control: max-age=0, must-revalidate
@programulya I would imagine you would only add a cache busting query string ( ?v=123...
) to your final vulcanized bundle.
FYI if clearing the cache doesn't work, you may have to clear your cookies too.
You shouldn't need to clear your cookies I don't think
I'm following the tutorial using Chrome 35.0.1916.114 on Mac OS X 10.9.3 and serving the pages with 'python -m SimpleHTTPServer' to url http://localhost:8000/step-3/
The styles appear to be cached such that changing any of them and reloading the browser window results in no change. Opening an Incognito window and going to the url gets me the result I expect, so the problem is caching... but where...
Is this a function of the python web server (I have not used it before) or is it a Web Components/Shadow Dom issue in the browser ?
thanks