-
Notifications
You must be signed in to change notification settings - Fork 584
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Support List property in useObject #4274
Conversation
0791f07
to
87bbad0
Compare
2714872
to
62580f4
Compare
7ec0152
to
3a28aa2
Compare
51ba882
to
4c70d71
Compare
8c7d285
to
3dbb581
Compare
Introduces the cachedObject which adds a proxy around a Realm.Object to handle rerendering on changes and to cache references to all Realm.Objects within a Realm.List.
4c70d71
to
3826ba1
Compare
Was the realm-core update intentional? |
@tomduncalf nope |
3826ba1
to
2f50a6e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'm submitting this half finished as something about my comments keeps freezing Github so I am hoping submitting them fixes this! 🙏
In general I think it looks great so far, most of these changes are just small things that I felt could be described/named better for people (like me) reading the code for the first time.
packages/realm-react/src/__tests__/useObjectRenderList.test.tsx
Outdated
Show resolved
Hide resolved
packages/realm-react/src/__tests__/useObjectRenderList.test.tsx
Outdated
Show resolved
Hide resolved
packages/realm-react/src/__tests__/useObjectRenderList.test.tsx
Outdated
Show resolved
Hide resolved
When a class extends Realm.Object, adding a listener to an instance of the object would not correctly type the object returned in the callback. With this change, the callback returns an object of the same type as the instance it was called from.
2f50a6e
to
cdce85f
Compare
d1deed6
to
bc164a6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is super cool! Great work 🎉
My comments/suggestions are mostly clarifying things that I struggled a little to wrap my head around when first reading the code – just making comments/names more explicit for people with no prior knowledge of how this works.
Added modifications to remove errors in commit
f098baa
to
fca595a
Compare
3031f22
to
cbc391e
Compare
* Phase 2: Add cache support for Realm.List in Realm.Object Introduces the cachedObject which adds a proxy around a Realm.Object to handle rerendering on changes and to cache references to all Realm.Objects within a Realm.List. * Fix types for Object Listener When a class extends Realm.Object, adding a listener to an instance of the object would not correctly type the object returned in the callback. With this change, the callback returns an object of the same type as the instance it was called from. * Apply suggestions from code review * Refactor useObject render tests into a single test suite
* Phase 2: Add cache support for Realm.List in Realm.Object Introduces the cachedObject which adds a proxy around a Realm.Object to handle rerendering on changes and to cache references to all Realm.Objects within a Realm.List. * Fix types for Object Listener When a class extends Realm.Object, adding a listener to an instance of the object would not correctly type the object returned in the callback. With this change, the callback returns an object of the same type as the instance it was called from. * Apply suggestions from code review * Refactor useObject render tests into a single test suite
* Add launch command for jest * Documentation of Realm React Add tsdoc notation to the public facing interfaces to realm/react. Also add comments to any possibly unclear blocks of code * Rearrange tsdocs for hooks and provider If one ctrl-clicks on the hooks or the provider in vscode, it navigates to the interface of createRealmContext. The comments have been moved here so the documentation can be found faster. * Add render tests to prove modifications ensure no unnecessary re-renders. * Collection Cache with Strong References (#4209) * Replace extra data re-render mechanism by just returning a new empty proxy * Support sorted and filter Deletions will cause the cache to be cleared. We have to live this this until the listener callbacks provide the ability to retrieve the objectId of the deleted object. * Refactor Test Suite Make use of description.each to test different types of collections. This includes sorted and filtered to show failing tests that must be fixed in the implementation of `cachedCollection`. * Add ability to debug the current open js file using node. * Support List property in useObject (#4274) * Phase 2: Add cache support for Realm.List in Realm.Object Introduces the cachedObject which adds a proxy around a Realm.Object to handle re-rendering on changes and to cache references to all Realm.Objects within a Realm.List. * Fix types for Object Listener When a class extends Realm.Object, adding a listener to an instance of the object would not correctly type the object returned in the callback. With this change, the callback returns an object of the same type as the instance it was called from. * Refactor useObject render tests into a single test suite * Rename example to testApp and remove old code. * Add tests for lists within a collection
What, How & Why?
This closes # ???
☑️ ToDos
Compatibility
label is updated or copied from previous entryBreaking
label has been applied or is not necessaryIf this PR adds or changes public API's: