4

I'm new to LWC, I'm trying to deploy code after changes but changes are not visible in the LWC Component. I also clear the cache many times but didn't see any changes in the browser. I also Disabled the 'Enable secure and persistent browser caching to improve performance’ checkbox but I cant see any changes after the code deployed . how to resolve this issue??

2
  • 1
    This is indeed an annoying problem, I ran into it myself (as well as many others): salesforce.stackexchange.com/questions/297325/… The way that I deal with it now: I give the LWC a new name each time I deploy, adding the current date+time to the name. That way, caches do not interfere. It is a bit awkward, but it works for me. Commented Apr 7, 2022 at 6:21
  • 1
    After normal page reload if changes are not visible then either I log out and log in again or edit the page, remove the component and again add it and save the page.
    – Night Guy
    Commented Apr 7, 2022 at 6:42

2 Answers 2

5

Here is what works for me in 99% of cases:

  • In setup make sure your user is in debug mode for lightning components
    • Setup > Custom Code > Lightning Components > Debug Mode
    • This will also allow you to have a non minified version of your component loaded in the browser, thus easier to add breakpoint and run in step by step mode
  • In Chrome DevTools, disable cache when dev tool is open (so keep it open)
    • Open DevTools > Go to settings > Preferences > Network > Disable cache (while DevTools is open)
    • This will prevent browser caching

And if the above doesn't work, I also do this:

  • In debug mode you have on the top right of the interface : EPT: X.Xs Y.Y KB, you can click on the "KB" tile before reloading
    • This is a way to tell SF to clear its cache of data
  • In the Chrome DevTools you can clear the application data
    • Open DevTools > Application tab > Storage > Unselect cookies / local & session storage > clear site data

As a side note : https://developer.salesforce.com/blogs/2019/02/debug-your-lightning-web-components

1

There's a few things you need to check.

First, check the Output logs for SFDX and make sure the code actually deployed. Make sure there's no errors being logged.

Second, make sure you're deploying to the correct org. It's fairly trivial to make this mistake when you're bouncing between orgs.

Third, make sure you're logging in to the correct org when testing.

Fourth, if you're using Digital Experiences, you always need to Publish before you will see your changes. I keep the Experience Builder open while deploying so I can quickly refresh and publish.

1
  • Why on Earth did it become mandatory to Publish in the Builder before new LWC components are visible. Is there a way to disable this behaviour? Commented Jun 22, 2022 at 0:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .