Realm-js: Disable debug mode only for Realm in React Native?

Created on 14 Oct 2018  路  12Comments  路  Source: realm/realm-js

I am trying to use Realm in my application. Since this issue exists and will not be fixed for the foreseeable future (https://github.com/realm/realm-js/issues/491), I am not able to put debug debug mode in React Native and I am searching for a way to debug the rest of the application. Note that the data I need to store is really big.

Is there a way either on iOS or Android to disable debug mode only on Realm, but still keep debugging the rest of the application using the chrome debugger?

I have tried debugging using Reactotron logs or any other method, but not being able to put a breakpoint in my application is really bad.

O-Community T-Enhancement

Most helpful comment

@csotiriou A disable debug feature should be high priority.

I will be replacing Realm Js with TypeORM & SQLite3 . The ONLY reason I am doing this extra work is because of the impact Realm JS has on debugging React Native apps.

Waiting a few years for potential architectural changes, that MIGHT improve things, by the React Native / Facebook core developers is not an option.

All 12 comments

@csotiriou A disable debug feature should be high priority.

I will be replacing Realm Js with TypeORM & SQLite3 . The ONLY reason I am doing this extra work is because of the impact Realm JS has on debugging React Native apps.

Waiting a few years for potential architectural changes, that MIGHT improve things, by the React Native / Facebook core developers is not an option.

@esutton have you tried using safari to debug instead? I actually prefer it and there isn't any performance penalty as the code is ran on the device, not the browser (like chrome).

@sambwest the JS bundle is minified in safari. There are no source maps there. There are also no redux dev tools nor react dev tools... unless I am missing something?

@csotiriou probably not. Sounds like your use case is more complex than mine.

@sambwest It's not complex, but it's a very big application. And big applications need proper breakpoints and dev tools.

We need a proper way to disable the debug mode in Realm separately from the rest of the app.

@csotiriou sure - not disputing it, just offering an alternative. I moved away from chrome not because of the performance (it doesn't affect me) but because 90% of the bugs I find with this library are due to the debugger in chrome. It behaves strangely in a number of ways. The bugs don't get fixed very quickly so it's a struggle for it not to effect development, hence my side step to safari. I would obviously welcome this if it were possible.

@sambwest I did not get far with Safari.

Safari debug seemed extremely primitive and had limited usefulness compared to Chrome debug. I did not see value in using Safari probably for reasons @sambwest stated:

the JS bundle is minified in safari. There are no source maps there. There are also no redux dev tools nor react dev tools...

A realm.debugEnable method to turn off all the Realm chatter, would enable debugging of a React Native application that was unfortunately tied to using Realm Js.

@esutton we're likely moving off of realm too - Safari debug mode is just too limited to build a larger application.

I'm planning to take a look at realm and see if there's any dirty workarounds we can use for the moment. @appden's comment with iOS being faster in #491 in debug mode has let us work with some of our javascript debugging tools.

It's definitely significantly slower on Android simulators than iOS. I suspect the issue on Android may either be from overhead with the virtual machine networking stack or the passing everything through the JNI.

@dlimx Any luck with any dirty work-arounds?

If so, please make a fork. I am sure many could benefit.

There is no guarantee that Facebook's multi-year long process of rearchitecting React Native will have * any * benefit to solving Realm's debugging performance problems. This affects debugging on all React Native apps that use Realm JS.

@esutton based on comments by the Realm team, we're just waiting for 0.58. I didn't find anything quick to exclude realm - so unless you don't need realm data for your current feature...

If the improvements introduced in v2.28.0 hasn't helped, we can reopen the issue.

Hey - looks like you forgot to add a T:* label - could you please add one?

Was this page helpful?
0 / 5 - 0 ratings