realm / realm-studio

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

RSTUDIO-539: Better visualization for mixed and dictionaries #1663

Closed gagik closed 5 months ago

gagik commented 5 months ago

Closes https://github.com/realm/realm-studio/issues/1662.

After:

Screenshot 2024-06-11 at 17 01 31 Screenshot 2024-06-11 at 17 01 51

Before:

Screenshot 2024-06-11 at 16 59 31 Screenshot 2024-06-11 at 16 59 38

Data Used

class Car extends Realm.Object {
  static schema = {
    name: "Car",
    properties: {
      car: "Car?",
      mixedField: "mixedField",
      hashMapField: "mixed{}",
    },
  };
}
...
realm.write(() => {
  realm.deleteAll();

  new Car(realm, { mixedField: [[123]], car: null });
  const car = new Car(realm, {
    mixedField: [],
    car: null,
  });
  new Car(realm, {
    mixedField: [[123]],
    car: null,
    hashMapField: { test: "nice", a: { b: "whatever" }, c: [1, 2, 3, {}] },
  });
  new Car(realm, { mixedField: [[123]], car: null });

  new Car(realm, { mixedField: [[123], car], car });
});