0

I have the LWC created for LWR Site that I am also using on Lightning quick action on Contact object.

When I click the quick action, I just get loading screen infinitely and LWC never loads.

enter image description here

here's the meta.xml

<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<isExposed>true</isExposed>
<targets>
    <target>lightningCommunity__Page</target>
    <target>lightningCommunity__Default</target>
    <target>lightning__Tab</target>
    <target>lightning__RecordAction</target>
    <target>lightning__RecordPage</target>
</targets>

I also tried adding the LWC to record page and it doesn't let me save, just throws unknown error.

I read here that it was known issue but fixed by SF but I still see the issue in full sandbox.

It worked once and then suddenly stopped loading. How do I get LWC to load on quick action or record page?

HTML:

<template if:true={recordId}></template>

Simplified JS:

@api objectApiName;
@api recordId;
   
@wire(getRecord, {
    recordId: USER_ID,
    fields: [NAME_FIELD, EMAIL_FIELD, LANGUAGE_FIELD]
})
wireuser({ error, data }) {
    //console.groupCollapsed('User Detail');
    if (error) {
        this.error = error;
        this.showUnexpectedError = true;
        this.isLoading = false;
        console.error('Error fetching User information : '+JSON.stringify(error));
    } else if (data) {
        this.name = data.fields.Name.value;
        this.email = data.fields.Email.value;

    }
    
10
  • If you open the browser Developer Tools, are there any errors being thrown? From past experiences, this kind of infinite loading is often due to a JavaScript error that has caused the component to not load correctly but not completely failed and shown an error to the user. Jan 12, 2023 at 1:09
  • No errors are being thrown, also the same component is working perfectly fine in an LWR site and a lightning tab under the same user context so it's really confusing what the error could be specific to quick action. Jan 12, 2023 at 15:17
  • So the known issue was reloading the page with the quick action open after it had been loaded successfully already - this sounds like it never loads ever from the quick action on first click? Are you able to share any logic in the javascript or a simplified version of what it is? Ex. Are you getting record Id which might not be working in quick action and holding up loading, do you have a loading spinner on your component/if conditions, etc. Jan 12, 2023 at 15:52
  • @KrisGoncalves I added simplified version of my JS file. And not setting recordId could very well be the issue as I know with quickAction it's different setting that but my spinner doesn't load and none of the lifecycle hook's console.log statements. I had referred to the answer you linked but let me try that again and I will get back. thank you for taking time. Also, I am using recordId in HTML so I thought I do not need to set it in renderedCallBack. Jan 12, 2023 at 16:35
  • 1
    @KrisGoncalves I figured out what was causing the problem for this LWC. I had an import import basePath from "@salesforce/community/basePath"; because I was using my LWC in a experience builder site, in salesforce it just keeps spinning and doesnt actually load the basepath. seems like a salesforce LWC bug I am going to figure out a way to submit that to SF. Jan 12, 2023 at 18:12

1 Answer 1

0

As this LWC was being used in community and lightning tab and lightning quick action, I had multiple import statements for both targets.

The infinite loading in lightning quick action was because I had an import statement for community import basePath from "@salesforce/community/basePath"; which is not allowed in other containers than community.

I commented the import statement and quick action can render LWC just fine. It's really surprising that SF is not throwing some useful error.

You must log in to answer this question.

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