0

Hello everybody I am getting the next error: 'Uncaught (in promise) ReferenceError: LWC component's @wire target property or method threw an error during value provisioning. Original error: [fillMapMarkersStructure is not defined]' I checked the spelling everything but I aint see any problem. Could anybody help me?

directionsListWired = [];
mapMarkers = [];
@wire(getDireccionesComunidadesEnergeticas)
wiredRelatedRecord(result){
    const{data,error} = result;
    if(data){
        this.directionsListWired = data;
        console.log('aqui...');
        fillMapMarkersStructure();
    }else if (error) {
        this.isLoading =false;
        this.records = undefined;
        this.error = error;
    }
}
fillMapMarkersStructure(){
    console.log('Entro2');
    this.mapMarkers = this.directionsListWired.map(direction => { return {
        location: {
            Street: direction.street,
            City: direction.city,
            PostalCode: direction.postalCode,
            State: direction.country
        },
        title: direction.name
        }
    })
    console.log('mapMarkers --> '+ this.mapMarkers);
}

1 Answer 1

1

Try to wrap your code in a Try-Catch block for ex - in wire service -

 try{
const{data,error} = result;
    if(data){
        this.directionsListWired = data;
        console.log('aqui...');
        this.fillMapMarkersStructure();
    }else if (error) {
        this.isLoading =false;
        this.records = undefined;
        this.error = error;
    }
 }catch(error){
  console.log(error);
 }

And I also see you are not calling the function fillMapMarkersStructure properly, below is the way to call the function- this.fillMapMarkersStructure()

You must log in to answer this question.