realm / realm-js

Realm is a mobile database: an alternative to SQLite & key-value stores
https://realm.io
Apache License 2.0
5.62k stars 558 forks source link

Add ability to pass a configured Realm instance to RealmProvider #6620

Closed susonthapa closed 1 month ago

susonthapa commented 1 month ago

Problem

I have a use case for accessing Realm within a React component and outside the component tree(e.g. accessing Realm from headless task or from CarPlay/Android Auto templates). At the moment, we can't pass a configured Realm instance to RealmProvider from @realm/react.

Solution

I'm using this approach to create a custom provider. I think it would be better if we could pass a configured Realm instance to RealmProvider instead of passing the schemas. I'm okay if this is something that won't be implemented as the workaround is working fine for me.

Alternatives

No response

How important is this improvement for you?

Fairly niche but nice to have anyway

Feature would mainly be used with

Local Database only

sync-by-unito[bot] commented 1 month ago

➤ PM Bot commented:

Jira ticket: RJS-2803

susonthapa commented 1 month ago

Duplicate of https://github.com/realm/realm-js/issues/6273