braze-react-native-sdk icon indicating copy to clipboard operation
braze-react-native-sdk copied to clipboard

[Bug]: On android, calling `Braze.getContentCards` right after `Didomi.setUserStatusSets` returns a never-resolving promise

Open AmauryLiet opened this issue 1 year ago • 1 comments
trafficstars

Which Platforms?

Android

Which React Native Version?

0.74.5

Which @braze/react-native-sdk SDK version?

11.0.0

Repro Rate

100% of the time, on release builds

Steps To Reproduce

NB: This is reproduced when using Braze & Didomi together, but the described erratic behaviour should be addressed regardless of Didomi implementation

import React, { useCallback, useEffect, useState } from 'react';
import Braze, { ContentCard } from '@braze/react-native-sdk';
import { Didomi, DidomiEventType } from '@didomi/react-native';
import { TouchableOpacity, View } from 'react-native';


const myVendors = ['my vendor id'];

export const App = () => {
  const enableCookies = useCallback(async () => {
    const currentUserStatus = await Didomi.getUserStatus();

    await Didomi.setUserStatusSets(
      currentUserStatus.purposes.consent.enabled,
      currentUserStatus.purposes.consent.disabled,
      currentUserStatus.purposes.legitimate_interest.enabled,
      currentUserStatus.purposes.legitimate_interest.disabled,
      [...currentUserStatus.vendors.consent.enabled, ...myVendors],
      currentUserStatus.vendors.consent.disabled,
      currentUserStatus.vendors.legitimate_interest.enabled,
      currentUserStatus.vendors.legitimate_interest.disabled
    );
  }, []);

  const [contentCards, setContentCards] = useState<ContentCard[]>([]);

  useEffect(() => {
    Didomi.addEventListener(DidomiEventType.CONSENT_CHANGED, async () => {
      const cards = await Braze.getContentCards();
      setContentCards(cards);
    });
  }, []);

  return (
    <View>
      <TouchableOpacity onPress={enableCookies} />
      {contentCards.map(renderCard)}
    </View>
  );
};

Expected Behavior

Braze.getContentCards() returns an array once cookies are enabled

Actual Incorrect Behavior

Braze.getContentCards() never resolves.

Regardless of Didomi integration, the call should return a value (error, empty array, filled array, ...) and not hang indefinitely

Verbose Logs

No response

Additional Information

No response

AmauryLiet avatar Sep 25 '24 16:09 AmauryLiet

Hi @AmauryLiet ,

  1. Can you provide verbose logs of a reproduction of the issue?
  2. What device were you testing on?
  3. What Braze Android SDK version did you reproduce the issue on?

radixdev avatar Oct 08 '24 18:10 radixdev

Closing out this issue due to inactivity.

If you would need further assistance, feel free to reach out to our support team at [email protected] with the supporting information listed above.

Thank you!

vanessaland avatar Dec 05 '24 20:12 vanessaland