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

realm.delete([filtered array of Realm.ObjectClass]) no longer works

      Description

      I'm testing the pre-release branch with our existing app. Removing a filtered list of {{Realm.ObjectClass}}es now throws an error but worked in 10.20.0 and earlier.

      Unable to find source-code formatter for language: typescript. 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
          function removeFilteredThings() {
              const thingsToBeRemoved = realm
                  .objects<RealmThing>(RealmThing.schema.name)
                  .filter(realmThing => realmThing.toDomainObject().when.isBefore(LocalDateTime.now(clock)))
              realm.write(() => {
                  realm.delete(thingsToBeRemoved)
              })
          }
      

      The objects appear to be Realm objects according to the debugger (they have __Realm_internal and _realm properties. All of our properties show as propName: Error: Exception in HostFunction: Realm accessed from incorrect thread. but I'm assuming that's down to Safari debugger trying to access the prop while paused on the thrown exception inside the realm.write() callback?

      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
      Error is: `Error: Exception in HostFunction: Argument to 'delete' must be a Realm object or a collection of Realm objects.`
      
      JS stack trace should be irrelevant since it's all within our code.
      

      Can you reproduce a bug?

      Yes, always

      Reproduction Steps

      Let me know if you can't reproduce and need me to try and come up with a minimal repro.

      Version

      hermes (10.20.0-beta.1)

      What SDK flavour are you using?

      Local Database only

      Are you using encryption?

      No, not using encryption

      Platform OS and version(s)

      RN 0.66.3 using JSC (not Hermes!) - iPhone 13 Simulator w/ iOS 15.2, Android AVD Emulator running Android 9.0

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

              Created:
              Updated:
              Resolved: