question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Removing many events causes them to sporadically reappear

See original GitHub issue

When 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)

  1. Add many events (around 50).
  2. Delete all of them.
  3. Add many more events.
  4. 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.

before after

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:26 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
Vizardscommented, Sep 6, 2018

@wmcmahan

I think I met the similar issue, I found that when I set the saveEvent option like this:

await RNCalendarEvents.saveEvent(title, {
          startDate,
          endDate,
          recurrenceRule: {
            frequency: 'weekly',
            occurrence,
            interval,
          },
          location,
          notes: 'my notes',
          alarms: [{
            date: -5,
          }]
        }, {
          futureEvents: true,
        });
  • The recurrenceRule and location cause saveEvent method can’t complete
  • The alarms 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 and alarms, 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.

3reactions
LorienHWcommented, Mar 25, 2019

@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 run npm uninstall react-native-calendar-events to remove an existing version to avoid caching issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set up or delete a repeating event in Calendar on Mac
In the Calendar app on your Mac, select the first occurrence of a repeating event. Press Delete, then click Delete All. Delete some...
Read more >
Coping With Re-Experiencing Symptoms in PTSD
News stories describing traumatic events can trigger re-experiencing symptoms, especially when those stories contain similarities to your own ...
Read more >
If Cell Changes (Abnormal Cells) Come Back | Information
Sometimes cell changes (abnormal cells) come back after treatment if we have a virus called human papillomavirus (HPV). Find out more here.
Read more >
Traumatic Events: Causes, Effects, and Management
PTSD can cause an intense physical and emotional response to any thought or memory of the event. It can last for months or...
Read more >
Unwanted memories: How to forget them - Medical News Today
Many people may experience unwanted memories following a traumatic event. Researchers are beginning to understand how the brain creates memories, stores them, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found