I think I have a grasp on the difference of COMPONENT and APPLICATION level events, and how to use them - however, I am running into a situation I cant get around.
- Lightning App configured
- Lightning Record Page defined for ObjectA contains instance of custom component "Notifications"
- Lightning Record Page defined for ObjectB contains instance custom component "Notifications"
- ObjectB record page contains another custom component for handling the modification of records in ObjectB. When you take specific actions in this custom component it generates a notification to appear in the "Notifications" component using an Application event. This is working as intended.
- In Lightning Console Application, I open ObjectA record, and then open related ObjectB record. The ObjectB loads, and generates its notification list. I click on the ObjectA subtab that is also already open, and unfortunately it is now also showing the same notifications.
I am already filtering the event firing by recordId - the instance of "Notifications" has the recordId available to it. Somehow the event is firing in ObjectB component, generating in the Notifications component as expected, but replicating across all instances of the component with no apparent way to stop it from happening.
event.stopPropagation(); does not appear to stop the event from replicating - just propagation. I am not having a problem with it going up the hierarchy.
I have tried to look into using GlobalID tags, COMPONENT level events instead, etc.
It looks like if you have a standard lightning record page with a component in a lightning console app you dont have access to control the container and its event handling to the level necessary.
Can anyone confirm or suggest another solution?
I need component to component communication when those two components are in a lightning record page in a lightning console application.