What problem are you facing?
The getContentCards() method currently lacks a built-in timeout mechanism, which can lead to indefinite loading states in poor network conditions.
// This promise can hang indefinitely
const cards = await Braze.getContentCards();
- No timeout parameter available
- No automatic rejection after X seconds
- Forces developers to implement manual timeout workarounds
In production apps, users on slow connections (3G, congested networks, corporate firewalls) may experience:
- Infinite loading spinners
- Poor user experience
- Unable to access cached content while waiting
Workarounds
We're forced to implement manual timeouts:
timeoutRef.current = setTimeout(() => setIsLoading(false), 5000);
Ideal Solution
// Option 1: Global configuration
Braze.configure({
contentCardsTimeout: 5000 // milliseconds
});
// Option 2: Per-call configuration
const cards = await Braze.getContentCards({
timeout: 5000
});
// Option 3: Separate method
const cards = await Braze.getContentCardsWithTimeout(5000);
Add native timeout support with:
- Configurable duration
- Proper error handling
- Fallback to cache on timeout
- Clear timeout vs network error distinction## Additional Context
Other Information
Many other SDKs provide timeout mechanisms:
- Firebase: Configurable timeouts
- Segment: 30s default timeout
- Amplitude: Built-in retry with backoff
This feature would greatly improve developer experience and app reliability.
- Using only
getCachedContentCards() - But we need fresh data
- Event-based approach - Still no guarantee of response
- Manual Promise.race() - Works but feels like a hack
Would the team consider adding this feature? Happy to contribute a PR if you provide guidance on the preferred approach.
What problem are you facing?
The
getContentCards()method currently lacks a built-in timeout mechanism, which can lead to indefinite loading states in poor network conditions.In production apps, users on slow connections (3G, congested networks, corporate firewalls) may experience:
Workarounds
We're forced to implement manual timeouts:
Ideal Solution
Add native timeout support with:
Other Information
Many other SDKs provide timeout mechanisms:
This feature would greatly improve developer experience and app reliability.
getCachedContentCards()- But we need fresh dataWould the team consider adding this feature? Happy to contribute a PR if you provide guidance on the preferred approach.