File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -41,15 +41,19 @@ const Leagues = (): JSX.Element => {
4141 */
4242 const fetchAdditionalUserData = async ( ) : Promise < void > => {
4343 try {
44- const promises = leagues . map ( ( league ) =>
44+ const entryPromises = leagues . map ( ( league ) =>
4545 getCurrentUserEntries ( user . id , league . leagueId ) ,
4646 ) ;
47- const entries = await Promise . all ( promises ) ;
48- const currentWeek = await getGameWeek ( ) ;
47+ const gameWeekPromise = getGameWeek ( ) ;
48+
49+ const [ entries , currentWeek ] = await Promise . all ( [
50+ Promise . all ( entryPromises ) ,
51+ gameWeekPromise ,
52+ ] ) ;
53+
4954 updateEntries ( entries . flat ( ) ) ;
5055 updateGameWeek ( currentWeek ) ;
5156 } catch ( error ) {
52- console . error ( 'Error fetching entries and game week:' , error ) ;
5357 throw new Error ( 'Error fetching entries and game week' ) ;
5458 }
5559 } ;
You can’t perform that action at this time.
0 commit comments