I need to display an alert in account record page when related opportunity's stage field is updated. For this I have created an component and added on the account page. The component is doing apex call after some time interval. In the controller class, I am checking the related oppotunities and returning a boolean flag if any stage is changed. is there any other way because the time interval is not looking like good approach.
You can create a reactive component by using the lightning emp api
The lightning/empApi module provides access to methods for subscribing to a streaming channel and listening to event messages. All streaming channels are supported, including channels for platform events, PushTopic events, generic events, and Change Data Capture events
basically, if you subscribe to certain field updates, and subscribe to the channel, you can trigger an alert in the users screen.