realm-browser-osx
realm-browser-osx copied to clipboard
RealmOptional nil values are not displayed correctly.
Realm object models that contain RealmOptional
s having nil
values are converted to 0
s by the browser.
I have attached an example Realm file that highlights this issue. This issue is extremely easy to reproduce just by opening the default.realm
file contained within the zip file in the browser.
Quickly debugging this issue revealed that the error happens already in RLMClassNode.m:112
in the call to _allObjects = [self.realm allObjects:self.schema.className];
which would indicate that this is most likely a realm-cocoa bug instead.
Thanks for reporting this @anlaital! I heard @TimOliver was looking into fixing this, I suspect he'll chime in here shortly with his thoughts/
Thanks for the report @anlaital! I had a look at it and ran some tests on my own.
I ran into the same 'nil values being converted to zeros' that you reported as well. I backtracked it to that same RLMRealm
call and was wondering maybe the dynamic API was serving incorrect values.
Turns out that wasn't the case. It turns out the Browser had a few checks in there to ensure data wasn't being passed back to the Realm file as nil
(harking back from the days before Realm supported nullability) and I get the feeling it was intentionally overriding those nil
values with empty data when the Realm file was opened.
I spent a bit of time tracking down where this overriding logic was happening and modified it to allow nil
values, and I also modified the UI to explicitly highlight when a property is nil
now.
The changes are currently in this PR: https://github.com/realm/realm-browser-osx/pull/175