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

Babel Plugin does not add primary key to schema if static primary key value is a variable

      How frequently does the bug occur?

      Always

      Description

      The Babel plugin does not add a primary key to the static schema of the TypeScript class when the value assigned to static primaryKey is a variable - e.g. a constant.

      The following example does NOT get a primary key added to the schema by the Babel plugin:

      const key = '_id';
      export class MyObject extends Realm.Object<MyObject>
        static primaryKey = key;
      

      The following example DOES get a primary key added to the schema by the Babel plugin:

      export class MyObject extends Realm.Object<MyObject>
        static primaryKey = '_id';
      

      Stacktrace & log output

      No response

      Can you reproduce the bug?

      Always

      Reproduction Steps

      No response

      Version

      Babel plugin 0.1.1

      What services are you using?

      Local Database only

      Are you using encryption?

      No

      Platform OS and version(s)

      Android 11 R API 30 - Pixel 5 emulator

      Build environment

      Which debugger for React Native: ..
      Flipper

      Cocoapods version

      No response

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

              Created:
              Updated: