Ionic Spinner | Spinner Not Dismissing After Switching between Multiple window tabs in Ionic cap

I am facing an issue with the spinner in my Ionic capacitor application. The problem occurs when I switch between multiple apps and tabs on my device or in Web application. The spinner, which is intended to indicate loading or processing, does not dismiss itself properly, leading to an undesirable user experience.
already i try with loader.dismiss() , loader.getTop() and setTimeout(()) but setTimeout(()) is not suitable for my requirement.
Any guidance or assistance in resolving this matter would be greatly appreciated.
Thank you in advance for your help.