Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.
This repository was archived by the owner on Apr 7, 2026. It is now read-only.

cancelTriggerNotifications returns before it's fully finished #549

@Yupeng-li

Description

@Yupeng-li

Hi,

I noticed that cancelTriggerNotifications sometimes returns before the scheduled notifications are removed from the database. So far I only noticed it on Android.

In the test below, the number of scheduled notification is not always zero after notifee.cancelTriggerNotifications returned.

await notifee.cancelTriggerNotifications()
console.log('number of scheduled notification:', (await notifee.getTriggerNotifications()).length) // not always 0

In our app, we cancel all notifications before scheduling a new one. The issue cases a race condition. Sometimes the first few notifications we scheduled are removed unexpectedly by the ongoing cancelTriggerNotifications. The example below shows what we are doing.

await notifee.cancelTriggerNotifications()
await notifee.createTriggerNotification(...)  // this notification could be removed 

I looked into the native code, do you think this might be the issue that the deletion occurs in the onSuccess callback?

WorkDataRepository.getInstance(getApplicationContext()).deleteAll();

Many thanks,
Yupeng

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions