Closed sukritchhabra closed 4 years ago
Hi @sukritchhabra - sorry for the delay in responding.
If you open a console while this issue is occurring and call localStorage
, do you see values in ab.storage.cc.[your-api-key]
? What about ab.storage.ccDismissals.[your-api-key]
?
Is there a staging instance where I can reproduce the issue to debug further? If you don't have or want to make something publicly available, you could raise this issue with our support team at https://www.braze.com/docs/support_contact in order to share those details privately (it'll come back to me if necessary).
@froodian No problem.
2.4.0
& 2.4.1
& 2.3.4
I do see info in localStorage
.
ab.storage.cc.[api-key]
- Contains the cards returned in the /sync
request.ab.storage.ccDismissals.[api-key]
- Looks empty: "{"v":{}}"
If this ^ info doesn't help I can reach out to support and we can try and troubleshoot there :)
I wonder if you're simply running into a race condition where you're calling getCachedContentCards
before the sync has completed. If you call it manually a second or two after the page finishes loading, do you see the cards you expect? In 2.4.x we did add functionality that requires the initial /api/v3/data
call to complete (to retrieve configuration from the backend) before content cards can sync. If that's the case, I wonder if subscribeToContentCardsUpdates
would be more appropriate to your use-case than getCachedContentCards
?
Yup, tried subscribeToContentCardsUpdates
with 2.4.1
and that worked 🎉
Thank you! :)
Out of curiosity, wondering if there's a way to listen (by the way of an async handler etc) for the finish of /data
? Since seems like getCachedContentCards
can lead to a race condition if triggered around the same time as the call to /data
?
There is not a great way to do that currently, sorry - we have an item on our roadmap to introduce a completion callback to requestImmediateDataFlush
which will be able to function for that purpose in the future.
Given that roadmap item, I'm going to close this issue since your use-case is now working for you, thanks!
Setup
"appboy-web-sdk": "2.4.0" & "2.4.1"
https://sdk.iad-03.braze.com/api/v3
With
2.4.0
&2.4.1
appBoy.getCachedContentCards()
was not providing any cards in the response.https://sdk.iad-03.braze.com/api/v3/content_cards/sync
shows cards in the response previewcards
array was empty (in the return from getCachedContentCards).Changing to
2.3.4
appBoy.getCachedContentCards()
returns all the cards for the user.https://sdk.iad-03.braze.com/api/v3/content_cards/sync
Seems like just changing the version fixes the issue. Not sure if I missed something in the setup for 2.4.x that may be causing this.