Skip to content

Commit 3fced58

Browse files
committed
feedback
1 parent e5de97b commit 3fced58

2 files changed

Lines changed: 21 additions & 21 deletions

File tree

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ export const diffInDays = (date1: Date, date2: Date): number => {
1515

1616
export const wrapThrowsAsync =
1717
<T, A extends unknown[]>(fn: (...args: A) => Promise<T>) =>
18-
async (...args: A): Promise<Result<T>> => {
19-
try {
20-
return {
21-
ok: true,
22-
data: await fn(...args),
23-
};
24-
} catch (error) {
25-
return {
26-
ok: false,
27-
error: error as Error,
28-
};
29-
}
30-
};
18+
async (...args: A): Promise<Result<T>> => {
19+
try {
20+
return {
21+
ok: true,
22+
data: await fn(...args),
23+
};
24+
} catch (error) {
25+
return {
26+
ok: false,
27+
error: error as Error,
28+
};
29+
}
30+
};
3131

3232
/**
3333
* Filters surveys based on the displayOption, recontactDays, and segments
@@ -77,7 +77,7 @@ export const filterSurveys = (
7777
);
7878

7979
default:
80-
throw Error("Invalid displayOption");
80+
throw new Error("Invalid displayOption");
8181
}
8282
});
8383

packages/react-native/src/lib/user/update-queue.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ export class UpdateQueue {
2121
}
2222

2323
public updateUserId(userId: string): void {
24-
if (!this.updates) {
24+
if (this.updates) {
2525
this.updates = {
26+
...this.updates,
2627
userId,
27-
attributes: {},
2828
};
2929
} else {
3030
this.updates = {
31-
...this.updates,
3231
userId,
32+
attributes: {},
3333
};
3434
}
3535
}
@@ -39,16 +39,16 @@ export class UpdateQueue {
3939
// Get userId from updates first, then fallback to config
4040
const userId = this.updates?.userId ?? config.get().user.data.userId ?? "";
4141

42-
if (!this.updates) {
42+
if (this.updates) {
4343
this.updates = {
44+
...this.updates,
4445
userId,
45-
attributes,
46+
attributes: { ...this.updates.attributes, ...attributes },
4647
};
4748
} else {
4849
this.updates = {
49-
...this.updates,
5050
userId,
51-
attributes: { ...this.updates.attributes, ...attributes },
51+
attributes,
5252
};
5353
}
5454
}

0 commit comments

Comments
 (0)