Uploaded image for project: 'Realm JavaScript SDK'
  1. Realm JavaScript SDK
  2. RJS-585

Delete fails when not in debugging mode

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None

      Goals

      Currently I'm having the following issue:

      • when I try to delete an object the delete operation fails
      • when I'm in debugging the delete works as intendend
      • the code is also very easy, low complexity

      <!--- What are you trying to achieve? -->

      Expected Results

      Deletion succesfull

      Actual Results

      <!--- What happened instead? -->
      <!--- e.g. the stack trace of a crash -->

      Steps to Reproduce

      No ideea, basically delete something ?

      Code Sample

      This is the model definition

      export class Routine {
        static schema = {
          name: 'Routine',
          primaryKey: 'id',
          properties: {
            id: 'string',
            name: 'string',
            exercises: 'Exercise[]',
          },
        };
      
        id: string;
        name: string;
        exercises: Exercise[];
      }
      

      This is the actual deletion

        const routines = realm.objects<Routine>(Routine);
        const routine = routineId ? routines.find((r) => r.id === routineId) : undefined;
        const [name, setName] = useState<string>(routine?.name ?? '');
      
        const handleDelete = useCallback(() => {
          const navigate = () => {
            realm.write(() => {
              realm.delete(routine);
            });
            navigation.pop();
          };
      
          if (routine.exercises.length === 0) {
            navigate();
           }
        }
      

      Version of Realm and Tooling

      • Realm JS SDK Version: 6.0.1
      • Node or React Native: React Native 0.61.5
      • Client OS & Version: MacOS Mojave 10.14.6
      • Which debugger for React Native: ?/ React Native Debuger

      Also, as I know that this claim is pretty bold, here's a zip file containing a video with the error happening and not happening when debugging is on
      tapastimer-repro.mov.zip

            Assignee:
            lubo.blagoev@mongodb.com Lubo Blagoev
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: