mrousavy / react-native-mmkv

⚡️ The fastest key/value storage for React Native. ~30x faster than AsyncStorage!
https://mrousavy.com
MIT License
6.2k stars 259 forks source link

Option to turn off remote debugging error #720

Closed jehillert-ziosk closed 2 months ago

jehillert-ziosk commented 2 months ago

I had my app set up to use async-storage for redux persist when in development mode, and also to use react-native-debugger by turning remote-debugging back on. Later I had it use mmkv in production and async-storage in dev mode to avoid the error and preserve debugging capabilities. Still later, I wanted to use mmkv in other parts of my app, for parts I didn't need to debug. I don't want to have to comment out all that code to enable debugging. Can you guys provide a config option that lets us turn off the error? Or is using mmkv anywhere in the app always going to crash when remote-debugging is turned on?

maintenance-hans[bot] commented 2 months ago

Guten Tag, Hans here! 🍻

Thanks for your report. It seems like you want more control over debugging with mmkv, but I need more information to help you better. Could you please provide any relevant logs from your app? For example, if you're using Xcode for iOS, please check the logs in Xcode's console or for Android, you can use adb logcat. This will help mrousavy understand what is happening.

Also, if you want your issue to be prioritized, consider supporting the project by sponsoring here. Let's get this worked out!

Note: If you think I made a mistake, please ping @mrousavy to take a look.

jehillert-ziosk commented 2 months ago

I'm not sure logs will help. This is what I'm talking about: https://github.com/mrousavy/react-native-mmkv?tab=readme-ov-file#limitations

You specifically say it won't work. And of course when it's in there it throws the error. I mean to say, your code seems to detect whether remote debugging is on, and automatically throws the error no matter how your library is being used. Why tell me about the error if I'm not going to debug anything having to do with mmkv, even though I use it in my app?

mrousavy commented 2 months ago

Remote debugging is not supported because react-native-mmkv uses JSI.

You can try hotpatching this and removing the error throw from the code, but I think this will jsut crash differently, because again - remote debugging is not supported as react-native-mmkv uses JSI. JSI does not support remote debugging.

There's other ways to debug.

jehillert-ziosk commented 2 months ago

I think maybe I misunderstand. I don't want to debug anything to do with mmkv. I just want to be able to have it as a dependency. to call it in files, without sending it through redux devtools. It sounds like you are saying that the way remote debugging works will cause the app to break because it will interact with mmkv no matter how mmkv is used in the app?