1

First, I apologize that I don't fully understand what's going on here. I am new to AngularJS and I am building an app that I am running on localhost:3000. I make changes to my files, and I refresh the localhost:3000 page. But after a few times of doing this, my changes do not get passed to the server.

Upon inspecting the developer tools, I see that it is using an older version of the file that I have overwritten with new code. No matter how many times I refresh the page, the changes do not get passed to the server.

If I come back after a few hours, it gets all the changes like it should. But only the first time, because every time after that I have the same problem.

I've tried restarting the http-server, I've tried closing and opening the editor, closing and opening the tab, restarting my computer, but none of these fixes the problem permanently.

If you need any more information, I'll edit it into this question. Thanks!

Romulus3799
  • 1,827
  • 3
  • 15
  • 20

2 Answers2

4

Try clearing your browser cache

Either

ctrl + f5

or

Right click on refresh button and choose the last option (hard reload)

(only in chrome, I guess)

Abhijeet Ahuja
  • 5,596
  • 5
  • 42
  • 50
2

That's almost certainly a caching issue.

You need to look at the network traffic when the page is downloading. How you do that will depend on the browser you use, but try pressing F12 for a start

Check the RESPONSE headers for anything "cache" Also check for a Status code of 304 - "Not Modified"

That might reveal to you instructions from the server to the browser to cache the file for a few hours, or that the browser is being told the copy it has is up to date.

Alternatively it might be server side caching, in which case I can't help you much.

One other solution is to change the file reference to include the date modified as a query string.

e.g.

instead of src="/scripts/myscript.js"
use src="/scripts/myscript.js?dt={filemodifieddateformyscripts.js}"

Roger Willcocks
  • 1,649
  • 13
  • 27