0

I am developing a custom LWR experience site and trying to console.log various things in my javascript controllers, but nothing valuable is being included.

I am familiar with JSON.serialize / JSON.parse trick while logging to get around proxy objects hiding what you're logging, but even doing this I am still unable to see the actual data.

For example, I have a custom event handler that receives a custom event from a component and logs it.

handleTagChange(event) {
    console.log('handle tag change', JSON.parse(JSON.stringify(event)));
    console.log('value', JSON.parse(JSON.stringify(event.detail)));
}

The first log prints {isTrusted: false, composed: false}

The Second log prints {value: 'aHUO9000000AyqwOAC', record: {…}, name: 'CCAC', objectType: 'Tag__c'}

I would expect the first log to show the detail, but it does not.

I have disabled lightning web security in both my org and in my experience

enter image description here enter image description here

How can I effectively log everything that's included on a POJO without having to know what properties exist beforehand to access them?

0

1 Answer 1

0

In LWR with LWS disabled there is no need to wrap what you are logging with JSON.parse(JSON.stringify()))

Simply logging console.log(POJO) will log what you are expecting to see

handleTagChange(event) {
    console.log('no manipulation', event);
}

Old habits die I hard I guess when Salesforce decided to Proxy wrap everything

You must log in to answer this question.

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