mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-01-12 22:50:20 +08:00
docs(database): persistence is disabled by default (#3899)
Co-authored-by: Mike Diarmid <mike.diarmid@gmail.com>
This commit is contained in:
@@ -10,8 +10,8 @@ and automatically managed by the Firebase SDKs.
|
||||
|
||||
# Enabling Persistence
|
||||
|
||||
Persistence is automatically enabled by default when using Realtime Database, however it
|
||||
[can be disabled](/database/usage#disabling-persistence). To enable persistence, call the `setPersistenceEnabled`
|
||||
Persistence is disabled by default when using Realtime Database, however it
|
||||
[can be changed to be enabled by default in the firebase.json](/database/usage#enabling-persistence). You can also enable persistence programmatically, by calling the `setPersistenceEnabled`
|
||||
as early on in your application code as possible:
|
||||
|
||||
```js
|
||||
|
||||
@@ -362,18 +362,18 @@ secondaryDatabase.ref();
|
||||
|
||||
# firebase.json
|
||||
|
||||
## Disabling persistence
|
||||
## Enabling persistence
|
||||
|
||||
By default the Realtime Database persists data on the user application, and is used by the SDKs for offline usage
|
||||
and caching. To disable this functionality, update the `database_persistence_enabled` key in the `firebase.json` file:
|
||||
The Realtime Database can be set to persist data on the user application to be used by the SDKs for offline usage
|
||||
and caching. To enable this functionality, update the `database_persistence_enabled` key in the `firebase.json` file:
|
||||
|
||||
```json
|
||||
// <project-root>/firebase.json
|
||||
{
|
||||
"react-native": {
|
||||
"database_persistence_enabled": false
|
||||
"database_persistence_enabled": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
To enable persistence, view the [Offline Support](/database/offline-support) documentation.
|
||||
For more on persistence, view the [Offline Support](/database/offline-support) documentation.
|
||||
|
||||
Reference in New Issue
Block a user