+ Start a Discussion
Nihar ANihar A 

New functionality not reflecting immediately after changing logic in lightning component.

If something goes wrong in lightning component and I go back to component bundle and mofidy the logic there and save and comeback to browser and refresh the page and execute the component , But the component is sometimes displaying the same old logic. Is it because the Javascript handler code is being cached in browser or any other reason. I am able to look at the new logic in browser after making three or four refreshes.
Best Answer chosen by Nihar A
Nihar ANihar A
Hello Everyone,

This workaround/ setting fixed the Issue.

1. Go to Setup.
2. Under "Administration Setup", go to Security Controls -> Session Settings.
3. Disable the "Enable secure and persistent browser caching to improve performance" option under Caching section and click on Save. 

Thanks,
Nihar.

All Answers

Greg_ThomsonGreg_Thomson
Nihar,

This is most likely due to the fact that Lightning components use the Aura framework server. The Aura server polls for changes at regular intervals to see if changes have been made to any components, and reloads them. If you download and run the open source Aura framework, and monitor the Jetty logs, you will see that after saving a component, it can take up to 10-15 seconds for it to see the change and load it.

I originally assumed, like you, that when a component request was made, that Aura would check to see if a change had been made, and if so, load that change. That is not the case.  I also assumed that browser caching was an issue - that also turned out to be incorrect.  The only answer is to be patient and let Aura detect the change.  I often will make a visual tweak/change/increment a version # when working on logic, so I am sure that when I refresh, I am testing the latest version.

Greg Thomson
Nihar ANihar A
Hello Greg,

Thanks for your response. Seems like the issue still exists.

I have run the component with an alert statement, then modified the alert statement and waited for like one minute an dwen t back to ui and invoked the component and it still gives me the same alert.Once again if i execute the component after giving the same alert, I get the new alert message that I modified.

Nihar.
Nihar ANihar A
Hello Everyone,

This workaround/ setting fixed the Issue.

1. Go to Setup.
2. Under "Administration Setup", go to Security Controls -> Session Settings.
3. Disable the "Enable secure and persistent browser caching to improve performance" option under Caching section and click on Save. 

Thanks,
Nihar.
This was selected as the best answer
David Roberts 4David Roberts 4
Thanks, Nihar. Saved hours of frustration!
Peter OgilviePeter Ogilvie
I have session caching turned off and I just had a case changes were not being refected after brower reload.   In fact I was getting a two day old version of my component that was VERY stale.   I logged in / out to create a new seeson and it still served up the stale version.   Very scary!  Finially after about an hour it started serving the update version.   whew!  
Matt UrbanowskiMatt Urbanowski
I get the same issue. This is the 2nd time it's happened where after extensive editing of a component, it suddenly starts showing older versions of the package. Refreshing and clearing cache etc doesn't work.
Javier CGJavier CG
Thanks Nihar. I had a big headache with this problem.
Frederic BELLENGERFrederic BELLENGER
I do confirm what Peter and Matt say. My js source doesn't refresh and the "Cache" option is off.
It's difficult to have its development progress in those conditions. I guess I only have to wait. 
Melissa De PauMelissa De Pau
We are having this issue right now. Our component is in a community, and after I make changes to the Javascript and refresh the community page, my changes are not available. Please advise.
Koustubh MasurkarKoustubh Masurkar
Do this to clear cache and hard reload. This will implement changes in one refresh.
1) Press f12 in chrome
2) Right-click on the reload button
3) Select 'Empty Cache and Hard Reload'
4) Press f12 to close developer tools

clear cache and hard refresh