You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.... other code....
let result: FascicoloDto = await this.mapper.mapAsync(fascicoloDocument, Fascicolo, FascicoloDto);
return result;
The afterMap callback, thought , doesn't await for the result of alimentazioneRepository.findById. Instead the execution continues and the 'return result' line got executed back in the service. Finally the debugger goes back to afterMap at line
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I'm trying to map a source object to a destination DTO with some afterMap async operation as shown here in the documentation
Here is my code
Profile
Repository
Call in service
The afterMap callback, thought , doesn't await for the result of alimentazioneRepository.findById. Instead the execution continues and the 'return result' line got executed back in the service. Finally the debugger goes back to afterMap at line
If i change the call to the repository method with another one that resolves immediately like the following everything works.
Fake call to the repository that resolves immediately
If i change the call to the repository method with another one that simulates a real async call, I get the same behavior of the original call
Fake call to the repository that resolves after some time
I can't figure out what is missing. Any help would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions