Comments (4)
I'm not sure this will be possible to do, but at a minimum it would be nice if ==
worked for all object types even if ===
does not.
from realm-js.
I'm almost positive there is no way to override ==
behavior for object comparisons. Do objects inside a Realm have some kind of unique identifier so we could track live objects exposed into a JS context? When I built a JS-ObjC binding, I accomplished this thanks to each object's "unique identifier" being its pointer. 😄
from realm-js.
We discussed last week that this would be possible for objects that have a primary key, since we can use the value of the primary key to track live objects in the JS context. I prototyped this in PR #118, and it works, but doesn't yet support changing the primary key on an object.
I believe this is more than just a "nice to have" since we cannot override ==
and object hashing like we can in the ObjC and Swift bindings (I know ObjC uses -isEqual
, not ==
, but that fits with how Cocoa works). Those bindings only support equality for objects with primary keys as well, so I think that a valid enough precedent for the JS binding to work similarly rather than blocking this issue on some future object id support in core.
Adding this would not only benefit us from having a functional ==
for primary-keyed objects, but would also allow for them to be used with Array.prototype.indexOf
(and friends) as well as with Map
s and Set
s.
from realm-js.
We are going to add some kind of unique id in the near future, so we should wait until it has been introduced in core/sync.
from realm-js.
Related Issues (20)
- relationships create whole object in realm list instead having reference HOT 1
- Realm app fails to authenticate users when running on Android emulator HOT 1
- Error when building the Android binding with an unexpected NDK HOT 1
- Refactor `ProgressRealmPromise` to register progress notifier only if needed HOT 1
- useObject and reinsertion item HOT 2
- Initializing a named sync Subscription leads to "undefined" HOT 6
- Major Bug: Documents and what library having is different with Listeners HOT 7
- SigSev Android 14 React Native 0.74.1 HOT 3
- Remove `use_frameworks` hack from Podspec HOT 1
- Upgrade to Realm Core v14.9.0 HOT 1
- NPM Always ask to install [email protected] instead of [email protected] ( in package.json ) HOT 2
- Unable to handle a manual client reset due to a missing function HOT 1
- logInWithFacebook is not working with iOS Limited Login HOT 1
- Run bindgen with symbols missing from opt-in list removed HOT 2
- Issue building for ARM/Linux HOT 4
- Inaccurate Return Type for `toJSON` Method in `RealmObject` HOT 2
- Zipped realm dependency is over 100MB HOT 2
- [Realm.Sync.Client.Network] Websocket Connection Fails with 308 Permanent Redirect Error HOT 21
- Upgrade to Realm Core v14.11.0 HOT 1
- RangeError: number is not integral, js engine: hermes (Vague) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from realm-js.