-
Type:
Bug
-
Resolution: Won't Fix
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
How frequently does the bug occur?
Always
Description
The underlying schema I'm referencing in useObject and the primary key are not changing at all which I've verified but the hook still returns brand new objects from the DB every few seconds.
I've had to solve this by manually writing the query using this alternative instead:
const data = useMemo(() => realm.objectForPrimaryKey(MySchema, variableWithId), [variableWithId]);
According to the docs the hook is supposed to only update on changes to the properties on the returned object?
> The hook will update on any changes to the properties on the returned object and return null if it either doesn't exists or has been deleted.
I've verified that isn't the case. The properties are being read from only - not modified.
Stacktrace & log output
No response
Can you reproduce the bug?
Yes
Reproduction Steps
- Have a valid Realm DB with a large Realm schema with some data
- Use useObject() in a React component
- Observe component re-render continously
Version
0.6.1
What services are you using?
Local Database only
Are you using encryption?
No
Platform OS and version(s)
realm 12.3
Build environment
react-native: 0.73.6
expo: 50.0.0
react: 18.2.0
react-dom: 18.2.0
Cocoapods version
No response