-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Async functions in alterItems don't work #367
Comments
I think the example below from the documentation is rather difficult to implement because every property of the (returned) object has to be checked (deep?) if it is a promise. alterItems(rec => { rec.userRecord = (async () => await service.get(...) )()}) It might be more straight forward if the users must wrap their whole altering function in a promise / make it a async function. What do you think? EDIT: I would be happy to make a PR for this issue |
@beeplin ^^^ any comments? |
I agree with @sean-nicholas. |
Okay, I will create a PR in the next few days |
Could you also please submit a PR for the docs? The file is feathers-plus/docs/source/feathers-hooks-common/index.md#alteritems . Thanks. |
Steps to reproduce
I ran the examples from https://feathers-plus.github.io/v1/feathers-hooks-common/#alteritems
You can find my code and output here:
https://gist.github.com/sean-nicholas/c0d73e386743a2b20f690aa473d88134
Expected behavior
alterItems should work with async functions as described in the documentation and in #307
Actual behavior
Promises are not resolved as you can see in the gist output file.
System configuration
Module versions (especially the part that's not working): 4.8.0
NodeJS version: 8.1.4
Operating System: macOS
The text was updated successfully, but these errors were encountered: