I have an LWC on a community which is working perfectly outside of the community but when ran on the community to pull the recordId from the url, it tries the wire with the initial blank value, then after it pulls in the recordId it isn't running the wire reactive again. It seems to work on my sandbox as it can find the record quick enough to not fail the first time, but in production it seems to take a little too long to grab the recordId from the URL. I also tried doing it manually with getters and setters but to no avail.

I have done all field and object importing above the copied code but as explained above, all is working outside of the community so I do not believe it to be at fault.


const fields = [FIELD1,FIELD2];

export default class userLWC extends NavigationMixin(LightningElement) {

    @api recordId;
    @track isSpinner = false;

    connectedCallback() {
        this.isSpinner = true;

    @wire(getRecord, { recordId: '$recordId', fields })
        this.record = result;
        const {error,data} = result;
        if (error){
            this.dispatchEvent(new ShowToastEvent({
                title: 'Error loading Record',
                message: error.body.message,
                variant: 'error'
        } else if (data){
            this.isSpinner = false;
            this.record = data;


    <template if:true={isSpinner}>
        <div class="spinner">
            <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    <lightning-card title="Test">
        <template if:false={isSpinner}>
            <div class="slds-var-m-around_medium">
                <div class="slds-float_right">


<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <masterLabel>Test Component</masterLabel>
    <description>Test Component.</description>
        <targetConfig targets="lightningCommunity__Default">
            <property name="recordId" type="String" label="Record ID" description="Should be set to {!recordId}" />
  • Does below link resolve your issue salesforce.stackexchange.com/questions/261178/…
    – Elijah
    Jan 19, 2022 at 12:15
  • I have looked through this post and the second one linked in the answer. Unfortunately it hasn't solved my problem. I can set up an on click that will tell me the recordId and it will be correct, the issue is that the 'reactive' wire pull isnt running again when the recordId changes
    – Jonathan
    Jan 19, 2022 at 12:28

1 Answer 1


As far as possible, try to avoid calling AuraEnabled methods via wire . Sometimes wire works perfectly sometimes it doesn't . Even if wire is an important concept and a good way of calling AuraEnabled methods , do not use wire when you experience problems while calling . So try calling your AuraEnabled methods imperatively using the same reactive variable. If reactive variable doesn't work add your imperative calling inside a method and call it when needed

Please let me know if it worked or not

  • So you mean by writing an Apex class to call imperatively as opposed to using the wire service?
    – Jonathan
    Jan 19, 2022 at 14:58
  • Yes Of Course . Wire works sometimes . Sometimes it doesn't . So try using imperative method. I too had a problem in getting Picklist Values for a Picklist field . The wire worked in one component and the other it didn't . Don't know why . So at times it is better to use imperative method than wire ones Jan 19, 2022 at 16:01

You must log in to answer this question.

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