I’m building an app that has groups of users. At the start of the app, I open a Realm for every group the user is part of, and persist the Realms throughout the app with React Context Provider. When a user creates a new group, though, I need to open a Realm for that new group, and add it to the list of realms in the Context Provider component.
Currently, I’m opening a new Realm for each new group that the user creates, and then I’m manually sticking them inside the existing list of Realms in the Context Provider.
However, I’m wondering if it’s possible to “refresh” the Realms after a user creates a new group by simply calling the function that opens all the user’s realms at the beginning of the app and generating a new list of Realms. While this strategy would be the least amount of code, I’m worried that this strategy may produce memory leaks or performance issues since I am not sure how to close the existing, open Realms (or whether they even need to be closed) prior to “refreshing” the Realms.
Thank you for the help!