Uploaded image for project: 'Realm Studio'
  1. Realm Studio
  2. RSTUDIO-541

Unable to create nested embedded objects in list

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

      Describe the bug
      When attempting to create a nested embedded object in an embedded object list in Realm Studio, the following error is displayed:

      Couldn't create the City:
      Cannot read properties of null (reading 'push')
      

      To Reproduce
      Steps to reproduce the behavior:

      1. Define the schemas as shown below:
      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
      class City extends Realm.Object<City> {
        static schema: Realm.ObjectSchema = {
          name: 'City',
          embedded: true,
          properties: {
            name: 'string',
          },
        };
      
        name!: string;
      }
      
      class Address extends Realm.Object<Address> {
        static schema: Realm.ObjectSchema = {
          name: 'Address',
          embedded: true,
          properties: {
            street: 'string',
            city: 'City',
          },
        };
      
        street!: string;
        city!: City;
      }
      
      class Person extends Realm.Object<Person> {
        static schema: Realm.ObjectSchema = {
          name: 'Person',
          primaryKey: '_id',
          properties: {
            _id: 'objectId',
            name: 'string',
            addresses: 'Address[]',
          },
        };
      
        _id!: Realm.BSON.ObjectId;
        name!: string;
        addresses!: Realm.List<Address>;
      }
      
      1. Attempt to create a City object within an Address object.
      2. See error.

      Expected behavior
      The City object should be created without errors.

      Screenshots

      Versions:

      • OS: Windows 11 Version 23H2 (OS Build 22631.4037)
      • Studio Version 15.2.1

      Additional context
      This issue does not occur when creating the same objects using the Node.js SDK.

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

              Created:
              Updated: