Skip to content

Unable to create nested embedded objects in list #1669

@emirhanaydin

Description

@emirhanaydin

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:
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
realm-studio-error

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions