Why does the salesforce icon won’t render properly?

348    Asked by darsh_6738 in Salesforce , Asked on May 2, 2023

I'm trying to add a custom lightning-icon to my experience cloud lwc module, but I can't make it render properly. The custom icon is basically a blue background color with a white dash in the middle.

I followed the steps described here: https://developer.salesforce.com/docs/component-library/bundle/lightning-icon/documentation

I've uploaded an .svg image with a tag containing an id as a static resource, just like the documentation said, but the image will render only the blue color without anything else. Then, I changed the .svg file (as I had noticed that the first image I had uploaded was square, instead of circular), and now the icon won't render at all.

If I try to open the file from the static resource on my org settings it will show the image properly.

Answered by Dipesh Bhardwaj

The salesforce icon won’t render properly - this could be a problem of referencing your static resources in the component module of lwc.But you observe that the icon is visible when opening in a personal org environment, that means your static resource may not be "public" in its cache control settings.

  Go to Setup-->static resource---> Open your static resource file---> Click Edit and re-upload it---> Select "Public" in the cache control settings dropdown and Save!

Your Answer

Interviews

Parent Categories