fix: fix recommendations viewed event count anomly (#787)

Co-authored-by: Syed Sajjad  Hussain Shah <syed.sajjad@H7FKF7K6XD.local>
This commit is contained in:
Syed Sajjad Hussain Shah
2023-03-24 14:38:52 +05:00
committed by GitHub
parent 6525c66600
commit fc37bbec1d
2 changed files with 13 additions and 6 deletions

View File

@@ -75,14 +75,14 @@ const ProgressiveProfiling = (props) => {
}, [authenticatedUser, registrationResponse]);
useEffect(() => {
if (registrationResponse) {
if (registrationResponse && authenticatedUser?.userId) {
const queryParams = getAllPossibleQueryParams(registrationResponse.redirectUrl);
if (enablePersonalizedRecommendations && !('enrollment_action' in queryParams)) {
const userIdStr = authenticatedUser?.userId.toString();
const userIdStr = authenticatedUser.userId.toString();
const showRecommendations = activateRecommendationsExperiment(userIdStr);
setShowRecommendationsPage(showRecommendations);
if (!showRecommendations) {
trackRecommendationsViewed([], true, authenticatedUser?.userId);
trackRecommendationsViewed([], true, authenticatedUser.userId);
}
}
}