-
Notifications
You must be signed in to change notification settings - Fork 585
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
realm object is empty on first run of app #1131
Comments
@agersoncgps I have exactly the same problem on Android emulator. You closed this issue, did you find out the reason or a fix for this? |
The Realm guys were unable to recreate the issue so I thought it was something uniquely messed up in my environment. It appears also to only happen in the simulator and not on device. I will re-open it. |
Thanks! I investigated further on the Android emulator. When I open the app for the first time and open a synced realm like in your example, the realm is empty. But it still gets downloaded into the /data/data/com.appid/files folder. Then, after refresh, it opens and reads this local file successfully. If I delete the realm files in the /data/data/com.appid/files folder manually, the same error shows up (realm file downloaded but empty). So I suspect that on the first run the file gets opened too early before the realm is setup correctly. But not sure why and how this happens. |
@Damnum are you creating the realm instance via the constructor or with |
@kristiandupont yeah I use Realm.open like this:
|
I see. In that case, you might have discovered a bug. If you can come up with reproduction case for us to look at, that would be great. |
@kristiandupont turns out the issue only happens when using the Chrome debugger. Same thing with my other problem (now closed): realm/realm-object-server#245 Given multiple tickets are open related to the Chrome debugger, I would suggest to make an additional comment in the docs: That the Chrome debugger is not slow (for me) but really buggy when using it with realm. All sorts of weird bugs happened when using it. I'm using Reactotron for debugging for the time being. |
@Damnum It looks like we should have a label called "Chrome Debugger" to track our issues with it. I label it as a bug for now, and we will prioritize to give a better debugging experience. |
I have an app that communicates with a read-only server hosted realm. I have tried this via a localhost server on my Mac (ROS v1.7.6) as well as an Amazon hosted Linux server (ROS v1.8.1). I have tried this with realm.js version 1.3.1 - 1.8.3.
If I choose Simulator->Reset Content and Settings from the iOS Simulator (to simulate a user who downloads the app for the first time), my console.log for the realm's length equals 0 after calling this function. I can call this function multiple times and its always 0 after wipping out the storage. If I hit comand-r to reload the React Native app inside the simulator and then call this function it returns 1300+ (what is expected), and then works for all future runs of the app.
I also tested this same code on the Android simulator. It returns 0 at all times, no matter how many times I reload. I also tested this same code in a blank node.js project with nothing else loaded besides realm and it corectly returned 1300+ records. All "error" objcts are null or undefined and both "user" and "realm" objects look valid when console.logged.
What could be happening that would explain this behavior?
The text was updated successfully, but these errors were encountered: