Funny mistake in Javascript

The javascript file preview [Dynamic] does not show the latest code. Why?


Problem

Visual studio Previewtask.js[Dynamic]

shows my old codes


Explanation of the problem

This is my current code in a task.js

file

enter image description here

But when I start my application and put a breakpoint on this screen, now the java-script preview shows my old code. The preview doesn't show my latest code.

see below image, this is my old code. I replaced $cookieStore.get('userInfo').UserId

it with 1

in taskby object

from my old code instead .

enter image description here


Note

See the yellow caption in the above images for more information. ,


What have I done . I tried to solve this issue below.

  • Click the "Save" button more and more times.
  • Click save all buttons
  • How many times have I cleared solutions.
  • also tried building and rebuilding the solution.

But doesn't work


My questions:

  • Why did this happen?
  • And how can we solve this?

Update:

I got the answer to the second question

How can we solve this? Ans: - I solved this problem by restartingvisual studio


But I don't know why this happened. Please tell me guy if you know.


+3


source to share


1 answer


Reason for release

Javascript files are cached by default for performance. Typically in a production environment, these files do not change all the time, so this is perfectly acceptable. Your development machine will act the same way too, so you need to bypass it. SO post on how JS files are cached


Decision:

In my experience, it is the browser cache that triggers this, and generally we just clear the cache before launching the site. So, in this order:

Change javascript



Save all

ctrl + shift + f5 in Visual Studio

When the browser opens, press f12, ctrl + r (clear cache) and press yes

When the cache is cleared, hit reload on the page.

If the above solutions don't work then restart visual studio

+2


source







All Articles