# Deep links (appUrlOpen) event running multiple times 10+

**URL:** <https://forum.ionicframework.com/t/deep-links-appurlopen-event-running-multiple-times-10/214749>\
**Category:** Ionic Framework\
**Created:** [September 8, 2021, 2:21pm UTC](https://forum.ionicframework.com/t/deep-links-appurlopen-event-running-multiple-times-10/214749 "2021-09-08T14:21:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![byurhanbeyzat](https://avatars.discourse-cdn.com/v4/letter/b/e9a140/32.png) [@byurhanbeyzat](https://forum.ionicframework.com/u/byurhanbeyzat)\
**Post date:** [September 8, 2021, 2:21pm UTC](https://forum.ionicframework.com/t/deep-links-appurlopen-event-running-multiple-times-10/214749/1 "2021-09-08T14:21:53Z")

</div>

Hi, I’m building an app where I have deep links to open app and run a specific function based on the url.  
But the event triggers multiple times and run same function after that I have 10+ alerts which needs to be confirmed.

This is from running app on real device with livereload

Here is my code as React Component

```auto
import { useEffect } from "react";
import { App, URLOpenListenerEvent } from "@capacitor/app";

import { useCamera } from "src/hooks";

const AppUrlListener: React.FC<any> = () => {
  const { startActionApprovalProcess } = useCamera();

  useEffect(() => {
    App.addListener("appUrlOpen", (event: URLOpenListenerEvent) => {
      let actionUrl: string | null = event.url.replace("myrecheck", "https");
      startActionApprovalProcess(actionUrl);
      actionUrl = null;
    });
    App.addListener("appStateChange", event => {
      console.log("appStateChange:", JSON.stringify(event));
    });
  }, [startActionApprovalProcess]);

  return null;
};

export default AppUrlListener;

```

I’m importing it on App.tsx (Firebase Notifications Listener too which runs multiple times again) like a normal component

```auto
<AppUrlListener />
<NotificationsListener />

```

And here are my console logs  
First I’m moving from app to the browser state changes  
Then open app from deep link and runs the event from which comes origin logs  
Then comes apps new state  
And then again logs from my function

```auto
VM3:207 result App.addListener (#8693379)
index.tsx:16 appStateChange: {"isActive":false}
VM3:207 result App.addListener (#8693383)
index.tsx:16 appStateChange: {"isActive":false}
VM3:207 result App.addListener (#8693385)
index.tsx:16 appStateChange: {"isActive":false}
VM3:207 result App.addListener (#8693387)
index.tsx:16 appStateChange: {"isActive":false}
VM3:207 result App.addListener (#8693389)
index.tsx:16 appStateChange: {"isActive":false}
VM3:207 result App.addListener (#8693391)
index.tsx:16 appStateChange: {"isActive":false}
VM3:207 result App.addListener (#8693393)
index.tsx:16 appStateChange: {"isActive":false}
VM3:207 result App.addListener (#8693395)
index.tsx:16 appStateChange: {"isActive":false}
VM3:207 result App.addListener (#8693402)
index.tsx:16 appStateChange: {"isActive":false}
VM3:207 result App.addListener (#8693404)
index.tsx:16 appStateChange: {"isActive":false}
VM3:207 result App.addListener (#8693378)
qr-decode.ts:12 url origin https://my.recheck.io
VM3:207 result App.addListener (#8693382)
qr-decode.ts:12 url origin https://my.recheck.io
VM3:207 result App.addListener (#8693384)
qr-decode.ts:12 url origin https://my.recheck.io
VM3:207 result App.addListener (#8693386)
qr-decode.ts:12 url origin https://my.recheck.io
VM3:207 result App.addListener (#8693388)
qr-decode.ts:12 url origin https://my.recheck.io
VM3:207 result App.addListener (#8693390)
qr-decode.ts:12 url origin https://my.recheck.io
VM3:207 result App.addListener (#8693392)
qr-decode.ts:12 url origin https://my.recheck.io
VM3:207 result App.addListener (#8693394)
qr-decode.ts:12 url origin https://my.recheck.io
VM3:207 result App.addListener (#8693401)
qr-decode.ts:12 url origin https://my.recheck.io
VM3:207 result App.addListener (#8693403)
qr-decode.ts:12 url origin https://my.recheck.io
VM3:207 result App.addListener (#8693379)
index.tsx:16 appStateChange: {"isActive":true}
VM3:207 result App.addListener (#8693383)
index.tsx:16 appStateChange: {"isActive":true}
VM3:207 result App.addListener (#8693385)
index.tsx:16 appStateChange: {"isActive":true}
VM3:207 result App.addListener (#8693387)
index.tsx:16 appStateChange: {"isActive":true}
VM3:207 result App.addListener (#8693389)
index.tsx:16 appStateChange: {"isActive":true}
VM3:207 result App.addListener (#8693391)
index.tsx:16 appStateChange: {"isActive":true}
VM3:207 result App.addListener (#8693393)
index.tsx:16 appStateChange: {"isActive":true}
VM3:207 result App.addListener (#8693395)
index.tsx:16 appStateChange: {"isActive":true}
VM3:207 result App.addListener (#8693402)
index.tsx:16 appStateChange: {"isActive":true}
VM3:207 result App.addListener (#8693404)
index.tsx:16 appStateChange: {"isActive":true}
qr-decode.ts:17 Success new apiUrl: https://my.recheck.io
VM3:233 native App.getInfo (#8693412)
qr-decode.ts:17 Success new apiUrl: https://my.recheck.io
VM3:233 native App.getInfo (#8693413)
qr-decode.ts:17 Success new apiUrl: https://my.recheck.io
VM3:233 native App.getInfo (#8693414)
qr-decode.ts:17 Success new apiUrl: https://my.recheck.io
VM3:233 native App.getInfo (#8693415)
qr-decode.ts:17 Success new apiUrl: https://my.recheck.io
VM3:233 native App.getInfo (#8693416)
qr-decode.ts:17 Success new apiUrl: https://my.recheck.io
VM3:233 native App.getInfo (#8693417)
qr-decode.ts:17 Success new apiUrl: https://my.recheck.io
VM3:233 native App.getInfo (#8693418)
qr-decode.ts:17 Success new apiUrl: https://my.recheck.io
VM3:233 native App.getInfo (#8693419)
qr-decode.ts:17 Success new apiUrl: https://my.recheck.io
VM3:233 native App.getInfo (#8693420)
qr-decode.ts:17 Success new apiUrl: https://my.recheck.io
VM3:233 native App.getInfo (#8693421)
VM3:207 result App.getInfo (#8693412)
VM3:207 result App.getInfo (#8693413)
VM3:207 result App.getInfo (#8693414)
VM3:207 result App.getInfo (#8693415)
VM3:207 result App.getInfo (#8693416)
VM3:207 result App.getInfo (#8693417)
VM3:207 result App.getInfo (#8693418)
VM3:207 result App.getInfo (#8693419)
VM3:207 result App.getInfo (#8693420)
VM3:207 result App.getInfo (#8693421)

```

```auto
Ionic:

   Ionic CLI : 6.17.0 (/Users/byurhanbeyzat/.nvm/versions/node/v16.3.0/lib/node_modules/@ionic/cli)
   Ionic Framework : @ionic/react 5.7.0

Capacitor:

   Capacitor CLI : 3.1.2
   @capacitor/android : 3.2.2
   @capacitor/core : 3.2.2
   @capacitor/ios : 3.2.2

Utility:

   cordova-res : not installed globally
   native-run (update available: 1.4.1) : 1.4.0

System:

   NodeJS : v16.3.0 (/Users/byurhanbeyzat/.nvm/versions/node/v16.3.0/bin/node)
   npm : 7.21.1
   OS : macOS Big Sur

```
