Issue
Preview of javascript file[Dynamic] does not showing latest code. Why?
Problem
Visual studio Preview of
task.js[Dynamic]
is showing my old codes
Explanation of the issue
This is my current code in task.js
file
But when i run my application and put break point in that screen, now the java-script preview showing my old code. The preview does not show my latest code.
see the below image, this is my old code. i have replaced $cookieStore.get('userInfo').UserId
instead on 1
in taskby object
from my old code.
NOTE
Please see the yellow markup in the above images for more proof.,
What am did – I was tried to solve this problem by below ways
- Pressed Save button more and more times
- Pressed save all button
- So many times i have cleaned the solutions
- also tried build and rebuild the solution.
But not working
My Questions :
- Why is this happened?
- And how can we solve this?
Update:
I got a answer for my second question
How can we solve this?
Ans : – I have solve this issue by restart visual studio
But i don’t know, why it’s happened. Please tell me guy’s, if you know.
Solution
Reason for the Issue
Javascript files are cached, by default, for performance. Normally, in a production env, these files aren’t constantly changing, so this is perfectly acceptable. Your development machine would be acting this way as well, so you need to work around it. SO post on how JS files are cached
Solution:
In my experience, it is browser cache that causes this and, ritualistically, we just clear the cache before we run the site. So, in this order:
Change javascript
Save all
ctrl+shift+f5 in Visual Studio
When browser opens, hit f12, the ctrl+r (clear cache) and click yes
When cache clears, hit reload on page.
If above solutions are does not working, then please restart the visual studio
Answered By – JasonWilczak
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0