Skip to content

Commit 0e71a2a

Browse files
committed
feedback
1 parent 7f96386 commit 0e71a2a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/react-native/src/lib/common/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ export const getLanguageCode = (
183183
export const shouldDisplayBasedOnPercentage = (
184184
displayPercentage: number
185185
): boolean => {
186-
const randomNum = Math.floor(Math.random() * 10000) / 100; // NOSONAR
187-
return randomNum <= displayPercentage;
186+
// NOSONAR: Math.random() is sufficient for non-security survey display logic
187+
return Math.random() * 100 < displayPercentage;
188188
};
189189

190190
export const isNowExpired = (expirationDate: Date): boolean => {

packages/react-native/src/lib/survey/store.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class SurveyStore {
2020
const prevSurvey = this.survey;
2121
if (prevSurvey?.id !== survey.id) {
2222
this.survey = survey;
23-
for (const listener of this.listeners) {
23+
for (const listener of [...this.listeners]) {
2424
listener(this.survey, prevSurvey);
2525
}
2626
}
@@ -30,7 +30,7 @@ export class SurveyStore {
3030
const prevSurvey = this.survey;
3131
if (prevSurvey !== null) {
3232
this.survey = null;
33-
for (const listener of this.listeners) {
33+
for (const listener of [...this.listeners]) {
3434
listener(this.survey, prevSurvey);
3535
}
3636
}

0 commit comments

Comments
 (0)