-
Notifications
You must be signed in to change notification settings - Fork 575
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
Expose realm ref when using RealmProvider in @realm/react #4571
Comments
@thespacemanatee Thanks for creating this feature request. We will report here when we have an update. |
@thespacemanatee The PR for this is currently under review. However, I wanted to ask about your client reset strategy. We have recently released an automatic client reset method and deprecated the usage of |
@takameyer thank you so much for the quick turnaround time for this, I will try the method that you linked and report back. As far as I know from the documentation, that technique does not work when there's a breaking change in the schema, but this should not happen very often in production. |
Hi, I'm not sure how we can use this ref - can you confirm a We're having issues getting anything out of For context, we're trying to use this realmRef to get progress state to show in the realmRef.current?.syncSession.addProgressNotification('download', 'reportIndefinitely',
(transferred, transferable) => setSyncProgress(transferred / transferable)
) |
@LukeStorry Can you provide more context on how you are setting your |
Yeah that code snippet is pretty much what I already had - have you tried running it? Issue is the |
@LukeStorry The snippet was deleted, as I just realized this doesn't work. I think the issue is that the underlying provider is awaiting Realm.open, which doesn't resolve until the sync has finished downloading. Please make a new issue so we allocate time to get this fixed. <RealmProvider
fallback={({progress: {transferred, transferable}}) => ...}
... But we should also make the |
Problem
Hello,
Thank you for this amazing service. When opening a
Realm
, one could handle client resets with the following code:and opening a Realm with the following sync config:
But with
@realm/react
, we cannot use theuseRealm
hook in the same component whereRealmProvider
is declared, and thus there is no way to close theRealm
in the error handler.This enhancement should be a high priority as the production app would simply break in the event of a client reset and users would have to reinstall a newer version of the app with the updated schema.
Solution
As mentioned by @takameyer, we should provide a ref prop to the RealmProvider and set the value when it’s rendered, so that it can be accessed in the error handler in the same component.
How important is this improvement for you?
Dealbreaker
The text was updated successfully, but these errors were encountered: