File tree Expand file tree Collapse file tree
packages/react-native/src/lib Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,19 +15,19 @@ export const diffInDays = (date1: Date, date2: Date): number => {
1515
1616export 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
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments