Removing many events causes them to sporadically reappear
See original GitHub issueWhen I remove and create many events (around 50) in quick succession (around 5 seconds apart), it sometimes doesn’t delete the old events, but instead, just adds the new events. I don’t get any errors removing the old events either.
Is there maybe some kind of limit to how many times you can hit the calendar API before it starts to ignore requests?
I’ve tried to be a bit “slower” in how I hit the calendar, for example, waiting until all the events are removed before I add them (with callbacks).
For some odd reason I can’t reproduce this with the simulator, I have to use the app on my iPhone.
Environment
Environment: OS: macOS High Sierra 10.13.6 Node: 9.4.0 Yarn: 1.1.0 npm: 3.3.10 Watchman: 4.5.0 Xcode: Xcode 9.4.1 Build version 9F2000 Android Studio: 2.3 AI-162.4069837
Packages: (wanted => installed) react: 16.3.1 => 16.3.1 react-native: 0.55.3 => 0.55.3
Steps to Reproduce
(in quick succession)
- Add many events (around 50).
- Delete all of them.
- Add many more events.
- Notice it didn’t delete the old events, but just added the new ones.
Here’s the “deleteCalendarEvents” function:
export const deleteCalendarEvents = function deleteCalendarEvents(params) {
let deletePromiseChain = [];
let eventIds = params.eventIds;
RNCalendarEvents.authorizeEventStore().then(fulfilled => {
if (fulfilled === "authorized") {
_.forEach(eventIds, (eventId) => {
deletePromiseChain.push(
RNCalendarEvents.removeEvent(eventId).then(event => {
console.log('deleted event', event);
})
.catch(error => {
console.log('delete event error', error);
})
);
});
Promise.all(deletePromiseChain).then(
success => {
if (params.callback) {
params.callback();
}
},
rejected => syncErrorAlert()
);
} else {
authErrorAlert();
}
});
};
Expected Behavior
It removes and creates many events in quick succession without a problem.
Actual Behavior
It doesn’t delete old events.
Issue Analytics
- State:
- Created 5 years ago
- Comments:26 (4 by maintainers)
Top GitHub Comments
@wmcmahan
I think I met the similar issue, I found that when I set the saveEvent option like this:
recurrenceRule
andlocation
cause saveEvent method can’t completealarms
may cause app crashed (but not every times).It only happens when I want to save more than one event. I used
forEach
to traverse and save different events.If I removed
recurrenceRule
,location
andalarms
, it works fine. Can you reproduce this issue?p.s. My React-Native version is 0.52.0. My
react-native-calendar-events
version is 1.6.3. Running on iOS 11.4 Simulator.@jmagdada Our fork is up to date with master in the base fork, so to try out our patch you can also set your npm dependency in your package.json file to
"react-native-calendar-events": "github:Outpatient/react-native-calendar-events#a7d8ef51c842b944011d478d7e003fbabe829443",
. In my experience, you may need to first runnpm uninstall react-native-calendar-events
to remove an existing version to avoid caching issues.