Skip to content
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

Merged
merged 4 commits into from
Feb 17, 2022
Merged

Conversation

takameyer
Copy link
Contributor

What, How & Why?

This closes # ???

☑️ ToDos

  • 📝 Changelog entry
  • 📝 Compatibility label is updated or copied from previous entry
  • 🚦 Tests
  • 📱 Check the React Native/other sample apps work if necessary
  • 📝 Public documentation PR created or is not necessary
  • 💥 Breaking label has been applied or is not necessary

If this PR adds or changes public API's:

  • typescript definitions file is updated
  • jsdoc files updated
  • Chrome debug API is updated if API is available on React Native

@cla-bot cla-bot bot added the cla: yes label Jan 27, 2022
@takameyer takameyer changed the base branch from master to react-integration January 27, 2022 10:05
@takameyer takameyer force-pushed the andrew/list-changes branch 2 times, most recently from 0791f07 to 87bbad0 Compare February 3, 2022 12:31
@takameyer takameyer force-pushed the andrew/list-changes branch 4 times, most recently from 51ba882 to 4c70d71 Compare February 14, 2022 11:09
@takameyer takameyer force-pushed the react-integration branch 2 times, most recently from 8c7d285 to 3dbb581 Compare February 14, 2022 12:02
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.
@takameyer takameyer marked this pull request as ready for review February 14, 2022 12:12
@tomduncalf
Copy link
Contributor

Was the realm-core update intentional?

@takameyer
Copy link
Contributor Author

@tomduncalf nope

Copy link
Contributor

@tomduncalf tomduncalf left a 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.

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.
@takameyer takameyer changed the title Andrew/list changes Support List property in useObject Feb 16, 2022
Copy link
Contributor

@tomduncalf tomduncalf left a 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
@takameyer takameyer merged commit e107d62 into react-integration Feb 17, 2022
@takameyer takameyer deleted the andrew/list-changes branch February 17, 2022 13:53
takameyer added a commit that referenced this pull request Feb 17, 2022
* 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
takameyer added a commit that referenced this pull request Mar 3, 2022
* 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
takameyer added a commit that referenced this pull request Mar 7, 2022
* 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
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants