Below is my publisher. It's nested in an Aura component, which is itself on a community page:

import {LightningElement, wire, track, api} from 'lwc';
import { CurrentPageReference } from 'lightning/navigation';
import { fireEvent } from 'c/pubsub';

export default class AppFeeProcInfoPub extends LightningElement {
    @wire(CurrentPageReference) pageRef;

    @api basePaymentInfo;

    get showCCForm() {}

    set showCCForm(value) {     
            let payload = Object.assign({}, this.basePaymentInfo);
            payload.renderComp = value;
            console.log('payload.renderComp: '+payload.renderComp);
            console.log('payload: '+JSON.stringify(payload));
            fireEvent(this.pageRef, "publisherLoaded", payload);
            console.log('paymentProcessorInfoPublisher publishing');            

When the page loads and the condition is met, it fires the pub event.

Below is my subscriber:

//LWC Framework
import { LightningElement, wire, track, api } from 'lwc';
import { registerListener, unregisterAllListeners } from 'c/pubsub';
import { CurrentPageReference } from 'lightning/navigation';
//Apex methods
import processPaymentTransaction from '@salesforce/apex/Aura_MedicalSchoolApplication.processPaymentTransaction';

export default class PaymentProcessor extends LightningElement {

    @api renderComp;

    @wire(CurrentPageReference) pageRef;

    connectedCallback() {
        registerListener("publisherLoaded", this.handlePublisherLoaded, this);

    disconnectedCallback() {

    handlePublisherLoaded(payload) {
        console.log('paymentProcessor recieving');
        console.log('payload.renderComp: '+payload.renderComp);
            this.renderComp = payload.renderComp;
            delete payload.renderComp

        this.paymentInfo = payload;         

When I preview the community page as an admin from the community builder, handlePublisherLoaded executes.

Here are the logs:

enter image description here

But logging in as a regular community user, handlePublisherLoaded does not execute. Here are the logs:

enter image description here

Why could this be?


Apparently the LWC's problem has nothing to do with it being a subscriber. I commented out all it's functions, left only its properties. It renders in builder preview but not when logged in as a community user. It's as if it is failing to load at all.


I just needed to publish my changes in the community.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.