ammarahm-ed / react-native-mmkv-storage

An ultra fast (0.0002s read/write), small & encrypted mobile key-value storage framework for React Native written in C++ using JSI
https://rnmmkv.now.sh
MIT License
1.59k stars 111 forks source link

Using Flipper. Getting Failed to process event for plugin react-native-mmkv-storage Error: Duplicate key #276

Closed dcassese closed 2 years ago

dcassese commented 2 years ago

I am working on an app where I am calling setString and setObject one after another. It seems that at times it misses a couple calls. I setup Flipper to debug and I noticed it was very inconsistent. I would not see all the Writes. Then I noticed many of these errors:

Failed to process event for plugin react-native-mmkv-storage Error: Duplicate key

Im writing a react native app. I have my MMKV instance and I access it via useContext throughout the app. On my loading screen I call an API and need to set about 12 records in MMKV. Is there a limit to calling the set functions?

Any insight here would be appreciated.

ammarahm-ed commented 2 years ago

@pnthach95 Do you want to look into this?

pnthach95 commented 2 years ago

@pnthach95 Do you want to look into this?

I'm on the road. I check later.

pnthach95 commented 2 years ago

So, I used time as key of data table, because MMKV APIs run ultra fast, all keys are the same (e.g.: time: "2022-08-20T13:27:27.438Z") and Flipper throws Duplicate key error. This is my plugin issue.

I published v1.1.0 of Flipper plugin. Check Plugin Manager if it auto-update.

ammarahm-ed commented 2 years ago

@pnthach95 Thanks for fixing!