-
Notifications
You must be signed in to change notification settings - Fork 586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Second insert to schema always throws error #3989
Comments
The issue is |
Thanks, that does look similar. Bummer, this worked on previous releases of Realm. I can clone the object as a workaround so |
You shouldn't have to. saveData = () => {
let workflows = {
InternalName: "Internal Name" + this.ctr;
ExternalName: "External Name" + this.ctr;
};
this.ctr++
try {
this.realm.write(() => {
this.record = this.realm.create(Workflows.schema.name, workflows);
})
this.record = this.realm.objects(Workflows.schema.name);
console.log(`Realm records: ${this.record.map((workflow) => workflow.InternalName)}`);
}
catch (error) {
console.log(error)
}
} BTW: Assigning |
This example above is a simplified example from the real project which uses typescript. We are upgrading from 2.2.8 to 10.8.0 and all these events worked as expected in the earlier release. I wanted to create a dummy app to show only the issue but the actual application we are upgrading uses Realm in many places, with several different schema's for inserts, updates, reads, deletes, etc.... We could try and change all of them to simple Objects but I feel that defeats a bit of the purpose. Just wanted to verify I was not doing something simple incorrectly, or if it was a bug, or if they created breaking changes in Realm between 2.2.8 and 10.8.0 that I need to accommodate for, |
@ProfessionalAmateur calling the constructor of a class-based model has never been officially supported. Our documentation has pointed to passing plain objects into Improving the developer experience of class-based models is one of the next things we'll be working on. |
How frequently does the bug occur?
All the time
Description
I am upgrading to Realm 10.8.0 and now when I perform a write/insert to a schema the first insert is successful and the second always throws an error similar to
[Error: Workflows.InternalName must be of type 'string', got 'null' (null)]
(I am hard coding the values for the insert so value is not null.Stacktrace & log output
Can you reproduce the bug?
Yes, always
Reproduction Steps
Package.json
Apps.js
10.8.0
What SDK flavour are you using?
Local Database only
Are you using encryption?
No, not using encryption
Platform OS and version(s)
Android 7.1.1
Build environment
Which debugger for React Native: ..
No debugger, writing errors to console.
The text was updated successfully, but these errors were encountered: