chore: revert react-native-mmkv to v3.x cp-7.78.0#30391
Conversation
Revert the MMKV major bump that landed in #29195 (RN 0.81.5 upgrade). The v3 -> v4 jump was not required by RN 0.81 / React 19 / Expo SDK 54 and shipped a latent crash in migration 106 (PPOM cleanup) because v4 makes `MMKV` a type-only export while migration 106 was still calling `new MMKV(...)` against `require('react-native-mmkv').MMKV`. Changes: - package.json: `react-native-mmkv` ^4.1.2 -> ^3.2.0 (resolves to 3.3.3) `react-native-nitro-modules` left pinned at 0.35.5 since `react-native-vision-camera` and other packages still need the new Nitro version. - app/store/storage-wrapper.ts: `createMMKV()` -> `new MMKV()`, `.remove(key)` -> `.delete(key)`, drop the `as MMKV` cast, `EventEmitter2` named import restored. - app/store/migrations/049.ts: factory -> constructor. - app/store/migrations/106.ts: drop the `require` + `// eslint-disable` workaround, use a plain `import { MMKV }`. Fixes the silent migration failure on devices that had PPOM storage. - app/store/migrations/136.ts: factory -> constructor, `.remove()` -> `.delete()` (this migration was added in #29542 after the bump landed, so it needed forward-translation to v3 rather than a true revert). - app/store/migrations/106.test.ts, 136.test.ts: revert mock factory exports from `createMMKV` to `MMKV`. - app/util/notifications/settings/storage/index.ts: all three callsites swapped from `createMMKV(...)` to `new MMKV(...)`. - app/util/test/testSetup.js, testSetupView.js: drop `createMMKV` from the module-level mock factory (v3 has no such export, so leaving it in would mask real production bugs in tests). - ios/Podfile.lock: regenerated. NitroMmkv pod + MMKVCore artifact removed; react-native-mmkv v3 pod added. Verified post-revert: no `createMMKV` references left in the codebase, no `import type { MMKV }` left, no v4-style `.remove(key)` on MMKV instances, lints clean across all touched files. `notificationStorage` test still uses `import { MMKV }` for a type annotation, which works since v3 exports `MMKV` as a class (value + type). TODO before merge: run the unit-test suite and an iOS/Android smoke build, plus the in-place upgrade canary scenario from #29195 to confirm v3 binaries can still read MMKV files that were written by v4 in any prior dev/internal build (production users are still on v3). Co-authored-by: Cursor <cursoragent@cursor.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
The MMKV revert commit picked up incidental SPEC CHECKSUMS drift for four pods that are unrelated to MMKV (boost, DoubleConversion, fmt, glog). Their pod versions (boost 1.84.0, DoubleConversion 1.1.6, fmt 11.0.2, glog 0.3.5) are unchanged on both sides; only the SHA-1 of the podspec contents shifted. There is no source change that would justify this drift — the only first-party RN patch (.yarn/patches/react-native-npm-0.81.5-d8232ef145.patch) touches ReactAndroid/build.gradle.kts and settings.gradle.kts, neither of which is an iOS podspec. The drift almost certainly came from a local CocoaPods/Ruby/Xcode environment difference when `pod install` was re-run as part of the MMKV downgrade. The "Check diff" CI job (.github/workflows/ci.yml) would catch the mismatch by failing on `git diff --exit-code` after a clean `yarn setup:github-ci`, so revert these four checksums to main's values to keep the PR diff strictly MMKV-only. Verified: `git diff main -- ios/Podfile.lock` now shows only the intended NitroMmkv/MMKVCore removal and react-native-mmkv 3.3.3 addition; no other pod checksums changed. Co-authored-by: Cursor <cursoragent@cursor.com>
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Why these tags:
Why not all tags: The E2E test path bypasses MMKV entirely (uses Performance Test Selection: |
|
Cal-L
left a comment
There was a problem hiding this comment.
Let’s cp these into 7.78 and 7.79



Revert the MMKV major bump that landed in #29195 (RN 0.81.5 upgrade). The v3 -> v4 jump was not required by RN 0.81 / React 19 / Expo SDK 54 and shipped a latent crash in migration 106 (PPOM cleanup) because v4 makes
MMKVa type-only export while migration 106 was still callingnew MMKV(...)againstrequire('react-native-mmkv').MMKV.CHANGELOG entry: null
Changes:
react-native-mmkv^4.1.2 -> ^3.2.0 (resolves to 3.3.3)react-native-nitro-modulesleft pinned at 0.35.5 sincereact-native-vision-cameraand other packages still need the new Nitro version.createMMKV()->new MMKV(),.remove(key)->.delete(key), drop theas MMKVcast,EventEmitter2named import restored.require+// eslint-disableworkaround, use a plainimport { MMKV }. Fixes the silent migration failure on devices that had PPOM storage..remove()->.delete()(this migration was added in feat: persist deeplink attribution with MMKV #29542 after the bump landed, so it needed forward-translation to v3 rather than a true revert).createMMKVtoMMKV.createMMKV(...)tonew MMKV(...).createMMKVfrom the module-level mock factory (v3 has no such export, so leaving it in would mask real production bugs in tests).Verified post-revert: no
createMMKVreferences left in the codebase, noimport type { MMKV }left, no v4-style.remove(key)on MMKV instances, lints clean across all touched files.notificationStoragetest still usesimport { MMKV }for a type annotation, which works since v3 exportsMMKVas a class (value + type).TODO before merge: run the unit-test suite and an iOS/Android smoke build, plus the in-place upgrade canary scenario from #29195 to confirm v3 binaries can still read MMKV files that were written by v4 in any prior dev/internal build (production users are still on v3).
Description
Changelog
CHANGELOG entry:
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Medium Risk
Reverts a major storage dependency version and updates MMKV instantiation/deletion APIs across migrations and wrappers, which can affect persistence and data cleanup behavior on upgrade. Risk is mitigated by targeted code changes and updated Jest mocks/tests, but should be validated with mobile smoke tests and migration paths.
Overview
Reverts
react-native-mmkvfrom v4 to v3 (updatespackage.json,yarn.lock, and iOS pods) and removes the Nitro-related MMKV pods fromPodfile.lock.Updates all touched call sites to match the v3 API: replaces
createMMKV(...)withnew MMKV(...), switches key deletion from.remove(...)to.delete(...), and simplifies migration106to use a standardimport { MMKV }(eliminating the priorrequireworkaround).Adjusts Jest mocks and migration tests (
106,136) to mock theMMKVconstructor-only export expected in v3 and to assert.delete(...)behavior.Reviewed by Cursor Bugbot for commit 042b30e. Bugbot is set up for automated code reviews on this repo. Configure here.