realm / realm-js

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

RJS-2784: Clear internal state to avoid crashes when React Native app is reloaded #6612

Closed kneth closed 1 week ago

kneth commented 2 weeks ago

What, How & Why?

This closes #6579

During development it is common to reload a React Native app. As it is a rough process, it is important to clear the previous state - including listeners. Realm Core provides some low-level method to clear many internal data structures, and by invoking these when the SDK is initialized (loaded in the app), any state from the previous app instance is removed.

Testing is difficult, and I have only tried it manually in a app running locally on my computer.

☑️ ToDos

kneth commented 1 week ago

Coverage tests crashed with "free(): invalid pointer", and we should investigate it