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

Persistence not passed to Realtime Database #529

Closed
YousefED opened this issue Oct 19, 2017 · 4 comments
Closed

Persistence not passed to Realtime Database #529

YousefED opened this issue Oct 19, 2017 · 4 comments
Assignees
Labels
plugin: app-core Firebase Apps / Core internals.

Comments

@YousefED
Copy link
Contributor

According to https://rnfirebase.io/docs/v3.0.*/core/initialize-apps, I should be able to set the persistence flag to true in config to enable Realtime Database Persistence.

I realize this is not supported for the Default App, but I'm using fb.initializeApp(config, "name") to initialize a different app. I think this feature is still meant to work for non-default apps right?

Setting breakpoints in the code, I noticed that persistence: true, is never passed to the database, so "if (this._options.persistence) {" always evaluates to false (https://github.com/invertase/react-native-firebase/blob/master/lib/modules/database/index.js).

@Ehesp
Copy link
Member

Ehesp commented Oct 19, 2017

cc @Salakar

Salakar added a commit that referenced this issue Oct 19, 2017
@Salakar
Copy link
Member

Salakar commented Oct 19, 2017

@YousefED thanks for flagging, have pushed up a fix for this that will appear in the next release,

As a temporary workaround until it's published you can call the same function as it would internally if it's enabled:

// call before any usage of the database - otherwise will throw an error
myNewApp.database()._native.setPersistence(true);

@Salakar Salakar closed this as completed Oct 19, 2017
@Salakar Salakar self-assigned this Oct 19, 2017
@Salakar Salakar added the plugin: app-core Firebase Apps / Core internals. label Oct 19, 2017
@YousefED
Copy link
Contributor Author

Awesome, thanks!

chrisbianca pushed a commit that referenced this issue Oct 23, 2017
@chrisbianca
Copy link
Contributor

This has now been released as part of 3.0.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: app-core Firebase Apps / Core internals.
Projects
None yet
Development

No branches or pull requests

4 participants