realm / realm-studio

Realm Studio
https://realm.io/products/realm-studio/
Apache License 2.0
300 stars 38 forks source link

Unable to create nested embedded objects in list #1669

Open emirhanaydin opened 1 week ago

emirhanaydin commented 1 week ago

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

{ static schema: Realm.ObjectSchema = { name: 'Address', embedded: true, properties: { street: 'string', city: 'City', }, };

street!: string; city!: City; }

class Person extends Realm.Object { static schema: Realm.ObjectSchema = { name: 'Person', primaryKey: '_id', properties: { _id: 'objectId', name: 'string', addresses: 'Address[]', }, };

_id!: Realm.BSON.ObjectId; name!: string; addresses!: Realm.List

; }


2. Attempt to create a City object within an Address object.
3. See error.

**Expected behavior**
The City object should be created without errors.

**Screenshots**
![realm-studio-error](https://github.com/user-attachments/assets/0bfcb912-1105-4f58-a280-4a6e3a752a03)

**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.
sync-by-unito[bot] commented 1 week ago

➤ PM Bot commented:

Jira ticket: RSTUDIO-541