In my LWC I have a few @api properties that are wired to a function that returns data from an Apex controller. However, one of these would be null be default. It seems that, as long as this property is null, the wire function is not firing.
import { LightningElement, api, track, wire } from 'lwc';
import getData from '@salesforce/apex/LightningController_MyController.getData';
export default class MyComponent extends LightningElement {
@api recordId;
@api relationshipName;
@api filter;
rows;
@wire(getData, {recordId: '$recordId', relationshipName: '$relationshipName', filter: '$filter'})
wiredData({error, data}) {
if(data) {
// do things
} else if (error) {
console.log(error);
}
}
}
As long as my filter
property is left empty in, say, the Page Builder, the function is not firing. Once I do fill in that property, it does fire.
I assume that, as it is reactive, it awaits the property to be assigned a value. Is this correct, and more importantly, how would I allow for @api-decorated wire arguments to be left empty?