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

realm class error when having property with string[], RangeError: Maximum call stack size exceeded.

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None

      Background: I'm using realm 3.6. I've been trying to migrate to the latest realm for ages but can't seem to get it to work out of the box. On 3.6 i'm using classes + static methods so i can just do stuff like Person.getById() and stuff. So i'm trying to do the same.

      For this example, I'm trying to do a simple string[] property on a realm class on a completely new react native init().

      class Person {
        get fullName() {
          return this.firstName + ' ' + this.lastName;
        }
        get homes(){
          return this.homes
        }
      }
      Person.schema = {
        name: 'Person',
        properties: {
          firstName: 'string',
          lastName: 'string',
          homes: 'string[]',
        }
      }; 
      

      This is my write and call method

        realm.write(() => {
                  const john = realm.create('Person', {
                    firstName: 'John',
                    lastName: 'Smith',
                    homes: ['singapore', 'indonesia']
                    });
                    });
                    let persons = realm.objects('Person');
      
                    for (let p of persons){
                      console.log("p full name", p.fullName)
                      console.log("p homes", p.homes)
                      }
                    });
                    }, [])
      

      The p full name gets called but the homes hit an error.
      How do i make a string array on a class property here?

      2020-08-15 10:03:24.083678+0800 realmlatest[72453:3711753] [javascript] 'p full name', 'John Smith'
      2020-08-15 10:03:24.200279+0800 realmlatest[72453:3711753] [javascript] Possible Unhandled Promise Rejection (id: 3):
      RangeError: Maximum call stack size exceeded.
      

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

              Created:
              Updated:
              Resolved: