File tree 2 files changed +13
-14
lines changed
2 files changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -41,14 +41,14 @@ export class Batch {
41
41
) ;
42
42
}
43
43
}
44
- const [ html , text ] = await Promise . all ( [
45
- this . renderAsync ( email . react as React . ReactElement ) ,
46
- this . renderAsync ( email . react as React . ReactElement , {
47
- plainText : true ,
48
- } ) ,
49
- ] ) ;
44
+ const reactElement = email . react as React . ReactElement ;
45
+ const html = await this . renderAsync ( reactElement ) ;
50
46
email . html = html ;
51
- email . text = text ;
47
+ if ( email . text === undefined ) {
48
+ email . text = await this . renderAsync ( reactElement , {
49
+ plainText : true ,
50
+ } ) ;
51
+ }
52
52
email . react = undefined ;
53
53
}
54
54
Original file line number Diff line number Diff line change @@ -52,14 +52,13 @@ export class Emails {
52
52
}
53
53
54
54
const reactElement = payload . react as React . ReactElement ;
55
- const [ html , text ] = await Promise . all ( [
56
- this . renderAsync ( reactElement ) ,
57
- this . renderAsync ( reactElement , {
58
- plainText : true ,
59
- } ) ,
60
- ] ) ;
61
- payload . text = text ;
55
+ const html = await this . renderAsync ( reactElement ) ;
62
56
payload . html = html ;
57
+ if ( payload . text === undefined ) {
58
+ payload . text = await this . renderAsync ( reactElement , {
59
+ plainText : true ,
60
+ } ) ;
61
+ }
63
62
}
64
63
65
64
const data = await this . resend . post < CreateEmailResponseSuccess > (
You can’t perform that action at this time.
0 commit comments