Skip to content

[BUG] React Native cache is incompatible with AsyncStorage v3 #1177

Description

@arelstone

Is there an existing issue for this?

  • I have searched the existing issues

SDK Version

  • @optimizely/optimizely-sdk: 6.6.1
  • @react-native-async-storage/async-storage: 3.1.1

Current Behavior

The React Native cache's getBatched() implementation calls AsyncStorage.multiGet(keys). AsyncStorage v3 replaced the multi* methods; its v3.1.1 interface provides getMany, but not multiGet.

The SDK also declares an AsyncStorage peer range of >=1.0.0 <3.0.0 in its package manifest, and its React Native import shim imports AsyncStorageStatic, which is absent from the v3.1.1 exports.

These incompatibilities are identified from source inspection. We have not reproduced a runtime failure on a device.

Expected Behavior

The built-in React Native cache supports AsyncStorage v3 while preserving compatibility with the currently supported v1/v2 versions. Batched reads return values in the requested key order and retain the existing missing-key behavior. Use of v3's default storage export should preserve access to existing legacy storage data.

Steps To Reproduce

Source-based reproduction; installation, compilation, and a device-level reproduction have not yet been run:

  1. Compare Optimizely's getBatched() call to multiGet with the AsyncStorage v3.1.1 public API, which provides getMany instead.
  2. Compare Optimizely's peer range and AsyncStorageStatic import with v3.1.1's package and exports.
  3. If peer validation is bypassed and the batched path runs with v3, the current call is expected to fail because v3's default export has no multiGet method.

SDK Type

React Native

Logs

No device log available; the incompatibility was identified through source inspection.

Severity

Blocking development — prevents adoption of AsyncStorage v3.

Workaround/Solution

Use getMany(keys) on v3 and map its returned record through the requested keys (for example, keys.map(key => values[key] ?? undefined)) to preserve order and missing-key behavior. Retain a multiGet path for v1/v2, replace the removed type import, widen the peer range, and test both API paths.

Activity

  1. junaed-optimizely commented on Oct 2, 2026

    @junaed-optimizely
    Contributor

    Hey @arelstone, Thanks for the report, your analysis is correct. The SDK currently supports AsyncStorage >=1.0.0 <3.0.0, so we're treating v3 support as an enhancement.

    We plan to add it in an upcoming release soon while keeping v1/v2 working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions