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

Collection Cache with Strong References #4209

Merged
merged 2 commits into from
Jan 13, 2022
Merged

Conversation

takameyer
Copy link
Contributor

@takameyer takameyer commented Jan 11, 2022

What, How & Why?

Since WeakRef is not supported in Hermes or JSC on Android, the code has been refactored to use strong references to accessed Realm Objects.

This PR also addresses the issue of a collection object reference being updated on relevant changes, by manually triggering on any changes and returning the collection wrapped in an empty proxy.

☑️ 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 11, 2022
@takameyer takameyer changed the base branch from master to react-integration January 11, 2022 13:20
@takameyer takameyer changed the title Andrew/strong ref Collection Cache with Normal References Jan 11, 2022
@takameyer takameyer changed the title Collection Cache with Normal References Collection Cache with Strong References Jan 11, 2022
@takameyer takameyer marked this pull request as ready for review January 11, 2022 14:25
@takameyer takameyer merged commit 8f3c9a7 into react-integration Jan 13, 2022
@takameyer takameyer deleted the andrew/strongRef branch January 13, 2022 10:35
takameyer added a commit that referenced this pull request Jan 19, 2022
* Use Strong References

* Replace extra data rerender mechanism by just returning a new empty proxy
takameyer added a commit that referenced this pull request Jan 25, 2022
* Use Strong References

* Replace extra data rerender mechanism by just returning a new empty proxy
takameyer added a commit that referenced this pull request Jan 26, 2022
* Use Strong References

* Replace extra data rerender mechanism by just returning a new empty proxy
takameyer added a commit that referenced this pull request Feb 10, 2022
* Use Strong References

* Replace extra data rerender mechanism by just returning a new empty proxy
takameyer added a commit that referenced this pull request Feb 14, 2022
* Use Strong References

* Replace extra data rerender mechanism by just returning a new empty proxy
takameyer added a commit that referenced this pull request Feb 14, 2022
* Use Strong References

* Replace extra data rerender mechanism by just returning a new empty proxy
takameyer added a commit that referenced this pull request Feb 17, 2022
* Use Strong References

* Replace extra data rerender mechanism by just returning a new empty proxy
takameyer added a commit that referenced this pull request Mar 3, 2022
* Use Strong References

* Replace extra data rerender mechanism by just returning a new empty proxy
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 16, 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.

1 participant