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 transforms #19
Comments
Can you give me an example of what you're trying to do with async transforms? |
I remember once wanting to make a request in a transform to get more info
|
I wanted to convert the data into another format and I was using some async API, but in the end I think doing it outside the request is better in this case. |
I remembered my use case better. We had data that had a slug and we needed to convert that to the actual value for the model, to get the values of the slugs, we needed to make a request for those. There was a race condition where the request for the data came back before the slug values request came back. This is why it was useful to have async transforms. Perhaps this could also be done with an interceptor though...? |
@kentcdodds yes, this is when you would want interceptors. Based on the Angular spec they are designed to handle async operations. Transformers are for mutating request/response data ( |
Awesome. Come to think of it, we may have switched over to an interceptor to accomplish what we were trying to do. Haha. Thanks for explaining that @mzabriskie! |
This is a duplicate and will be resolved with #14 |
Hey @nickdima, I'm in the same situation here trying to parse responses converting String dates into moment.js object, how did you fix that? I've created a interceptor but its taking much time to parse it when we have a big response, did you a find a way to do that asynchronously? |
What do you think about returning promises from transforms? I have a case where I need to perform some async operation in a transform.
The text was updated successfully, but these errors were encountered: