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

Realm in React Native loses data after long time inactivity and internet disabled

      How frequently does the bug occur?

      Sometimes

      Description

      I close the app in the night, and I put my phone on airplane mode to disable the internet.
      In the morning, I open my app.
      What is expected: To find my data stored in Realm.
      What actually happened: All data deleted.

      Stacktrace & log output

      Unable to find source-code formatter for language: shell. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      This how we write data in Realm:
      
      try {
          realm.write(() => {
            for (let entity in downloadedData) {
              const existingData = realm
                .objects("MyObject")
                .filtered(`id = ${downloadedData[entity].id}`);
              if (!existingData.length) {
                realm.create(
                  "MyObject",
                  {
                    id: downloadedData[entity].id,
                    name: downloadedData[entity].name,
                  },
                  "all",
                );
              }
            }
          });
        } catch (error) {
          console.error(error);
        }
      

      Can you reproduce the bug?

      Sometimes

      Reproduction Steps

      The bug is not systematic. It doesn't happen always and not in all Android devices.
      To reproduce the bug you should keep your app inactive for a long time and the internet disabled.
      Then open the app.

      Version

      SDK 28 & SDK 33

      What services are you using?

      Local Database only

      Are you using encryption?

      No

      Platform OS and version(s)

      Android (both emulator and real device)

      Build environment

      Which debugger for React Native: ..
      "react-native": "^0.73.2",
      "@realm/react": "^0.6.2",
      "realm": "^12.5.1",

      Cocoapods version

      1.14.2

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: