Make iOS Capacitor CAPPluginCall notifyListener to wait for reactjs async indexdb “put” call

I have a capacitor plugin to bridge Swift and Reactjs, basically to run a PWA on an iOS device, but some part of the code is written in Swift in this app, thus when I switch from Reactjs to Swift, the javascript main thread is blocked by swiftui screens, and all the background async task in javascript comes to a halt. Here in Swift, I have defined some listeners using the capacitor notifyListener function, which sends notifications to Reactjs when some event occurs in Swift, one such listener is responsible for setting some data in the Reactjs indexedDB, but since the main thread is blocked (according to my knowledge), that indexedDB updation async call is thrown into some queue, and I do not get any response back from the DB, but when I close the swiftui screens and come back to the Reactjs code, the updation happens and I get the desired response.

So my question here is, is there some way by which I can wait in Swiftui, till that DB async call finishes and I can get the result at the same time without closing the Swiftui screens and coming back again?

Here is the sample code for your reference. Any help will be appreciated.

Listener in swift –

do {
      try activationScheduler?.startActivationTimer()
      self.notifyListeners(self.onTripStart, data: ["transactionId": options.booking.id])
   } catch {
      debugPrint("Failed to start activation timer: (error)")
   }

Code in Reactjs which runs when notification is raised from swift –

useEffect(() => {
    const activationFlowTripStartListener = ActivationFlowPlugin.addListener('onTripStart', (eventData) => {
      handleSetPassAndTicketWithDB(eventData);
    });

    return () => {
      activationFlowTripStartListener?.remove();
    };
  }, [userId]);

const handleSetPassAndTicketWithDB = useCallback(async (passData) => {
    const decryptkey = getKeyForEncryptAndDecrypt(userId);
    const { get } = IndexDB(objectStoreKeys.myPassHistory);
    let pass = await get(passData?.transactionId, decryptkey);
    const newCachedPassData = {
      ...pass,
      ...pass?.cachedPass,
      isContactLessValidationVisited: true,
      isRidePresent: true,
    };
    await setUserPass(newCachedPassData);
  }, [userId, setUserPass]);

Also one more thing as you can see here, I am “getting” and “setting” data in the IndexedDB. The get function is working correctly, the issue arises only when I use the set function of the IndexedDB object.

The await setUserPass function call above calls this function to update the indexedDB –

const setHistoryData = useCallback(async (newData) => {
    if (newData?.transactionId) {
      const decryptkey = getKeyForEncryptAndDecrypt(phoneNumber);
      const { set } = IndexDB(objectStoreKeys.myPassHistory);
      await set(undefined, { newData }, decryptkey);
    }
    return 0;
  }, [phoneNumber]);

And here is the set async function of the IndexedDB object –

set: async function set(key, val, encryptKey) {
    const encryptData = encryptObject(val, encryptKey);
    return (await dbPromise).put(`${objectStore}`, encryptData, key);
  },
get: async function get(key, decryptKey) {
    const data = await (await dbPromise).get(`${objectStore}`, key);
    return decryptObject(data, decryptKey);
  },