diff --git a/CHANGELOG.md b/CHANGELOG.md index 78bdd0d00f..ddd9b6daf1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ * `data` and `string` are now strongly typed for comparisons and queries. This change is especially relevant when querying for a string constant on a Mixed property, as now only strings will be returned. If searching for `data` is desired, then that type must be specified by the constant. In RQL the new way to specify a binary constant is to use `mixed = bin('xyz')` or `mixed = binary('xyz')`. ([realm/realm-core#6407](https://github.com/realm/realm-core/issues/6407)) * Fixed diverging history due to a bug in the replication code when setting default null values (embedded objects included). ([realm/realm-core#7536](https://github.com/realm/realm-core/issues/7536)) * Null pointer exception may be triggered when logging out and async commits callbacks not executed. ([realm/realm-core#7434](https://github.com/realm/realm-core/issues/7434), since v12.6.0) +* Fixed a bug which caused crashes when reloading React Native apps. ([#6579](https://github.com/realm/realm-js/issues/6579), since v12.0.0) ### Compatibility * React Native >= v0.71.4 diff --git a/packages/realm/src/Realm.ts b/packages/realm/src/Realm.ts index 1395c2ec33..5ed5aab8e7 100644 --- a/packages/realm/src/Realm.ts +++ b/packages/realm/src/Realm.ts @@ -1360,6 +1360,6 @@ export namespace Realm { export import PushClient = internal.PushClient; } -//Set default logger and log level. +// Set default logger and log level. Realm.setLogger(defaultLogger); Realm.setLogLevel(defaultLoggerLevel); diff --git a/packages/realm/src/platform/react-native/index.ts b/packages/realm/src/platform/react-native/index.ts index 6974fd57a2..4eff6da924 100644 --- a/packages/realm/src/platform/react-native/index.ts +++ b/packages/realm/src/platform/react-native/index.ts @@ -23,4 +23,10 @@ import "./device-info"; import "./sync-proxy-config"; import { Realm } from "../../Realm"; +import { binding } from "../binding"; + +// Clear the internal state to prevent crashes when reloading the app +binding.RealmCoordinator.clearAllCaches(); +binding.App.clearCachedApps(); + export = Realm;