-
Notifications
You must be signed in to change notification settings - Fork 572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RJS-2648: Add ability for Realm instance to be used in RealmProvider #6714
Conversation
…lm-react/src/index.tsx
… packages/realm-react/src/index.tsx
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.
Some things worth discussing.
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.
Nice to see this feature coming alive 🎉 Leaving my comments from a first pass. (Haven't gone through all of it yet.)
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.
I really like they way you're expressing the two mutually exclusive modes of the provider and also tying that back with the createRealmContext
- Great stuff! 🎉 I have minor comments, but nothing blocking a merge.
I think it would be good to have a few tests using |
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.
Awesome work and nicely documented! 🙂
Co-authored-by: LJ <81748770+elle-j@users.noreply.github.com>
…m-js into gagik/realm-instance-provider
Co-authored-by: Kræn Hansen <kraen.hansen@mongodb.com>
…m-js into gagik/realm-instance-provider
What, How & Why?
@realm/devdocs
What, How
RealmProvider
(or any empty provider created fromcreateRealmContext()
) is the most generic provider which has mutually exclusive PropTypes that accepts either an existing realm or Realm configuration fields as props.createRealmContext(realm)
is a simple wrapper with no props, just children. NOTE: This provider is not necessary, you can use the hooks without it as long as you import from the correct context!createRealmContext({schema: [...])
allows you to use all the Realm configuration settings as well as the existing special@realm/react
props.Nesting
If two default providers are nested, the deepest provider will take precedence, i.e.
Same applies for configuration-based providers.
Why?
Unlocks new usecases and abilities for the
RealmProvider
, where one might want to use their own managed Realm in the context.This closes #6283
☑️ ToDos
Compatibility
label is updated or copied from previous entryCOMPATIBILITY.md
package.json
s (if updating internal packages)Breaking
label has been applied or is not necessary