2

I created an LWC and put it on my community homepage. The LWC loads fine on the workspace builder as well as on the published site.

My problem is that when I make a change to my LWC and deploy it to my org, the changes are not reflected on the community site until I publish the page.

Is there a way I can put my LWC on the community page and not have to keep publishing the page every time I make an update to the LWC?

I am trying this in my developer edition org if that makes a difference. The site status still shows as "Preview" after it's pubished but I am able to go to the public url.

I have cleared my cache and also disabled the "Enable secure and persistent browser caching to improve performance" option in Settings > Session Settings but that did not help.

3
  • 1
    You have to publish to update the underlying SPA (single page app) generated for/published from the experience bundle.
    – Phil W
    Nov 7, 2021 at 11:34
  • I've worked on community pages with LWCs before. We only needed to publish the page once after we put the LWCs on there. Then after any LWC updates were deployed, the changes were seen on the public site without having to publish the page. Not sure why what i'm doing is any different.
    – 626
    Nov 7, 2021 at 22:47
  • Change in platform version? Explore how the LWC code is delivered as part of the over-all SPA using your browser's dev tools.
    – Phil W
    Nov 8, 2021 at 3:18

1 Answer 1

2

It sounds like you are using LWR, which is how its designed to work. It creates (and publishes) a static snapshot of your site.

Saying that, you should see an updated version of the site via the preview in the Experience Builder.

When you preview your site in Experience Builder, Lightning web components are served dynamically, which means the preview always shows the most up-to-date versions of your components and data. (LWR Sites for Experience Cloud: New Publishing Model )


If you don't want to have to publish your community each time, you'd be looking at using the Build Your Own (Aura) template. This will add back the /s/ to your URLs and will run slower than the newer LWR template.

Which Experience Builder Template Do I Use? is useful to review what you may want/need.

If you stick with LWR, I'd suggest checking out Template Limitations to make sure you don't need any of this functionality. (one thing that gets me is not supporting async/await. Losing Audiences and Page Variations may also be a big one for some users)

3
  • Thank you! Yes, I'm using LWR. Which one do I use so I don't have to publish when I deploy LWC changes?
    – 626
    Nov 8, 2021 at 21:03
  • If you don't want to have to publish your community each time, you'd be looking at using the Build Your Own (Aura) template. This will add back the /s/ to your URLs and will run slower than the newer LWR template.
    – lu_ke____
    Nov 9, 2021 at 0:05
  • 1
    Thank you for your detailed response. Those limitations are very useful to know.
    – 626
    Nov 9, 2021 at 3:44

You must log in to answer this question.

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