I don't know much about these things, but was wondering if there's a reason to prefer async generator/regenerator vs. something like fast-async which _claims_ to be 3-4 times faster?
Interesting. I'll benchmark changing this.
Apparently fast-async doesn't support calling await on normal functions that don't return a Promise. So if you, for example make a component which has a static getInitialProps instead of static async getInitialProps it will fail. Also, we have to drop the es2015 preset to implement fast-async, since it conflicts with babel-plugin-transform-runtime 馃槩 Also looked into kneden but that one is unmaintained from the looks of it.
If there is something else we can look into please let me know 馃憤 馃槃
Thanks for looking that up. Would be good to give the feedback over there
@timneutkens I opened an issue over there and there are suggestions on how to fix your concerns: https://github.com/MatAtBread/fast-async/issues/32#issuecomment-276014312
So if you, for example make a component which has a
static getInitialPropsinstead ofstatic async getInitialPropsit will fail.
To implement this properly we just need to wrap the getInitialProps return value with Promise.resolve(). (something like await Promise.resolve(this.getInitialProps())). It seems weird to me to rely on the parser for that behavior.
@TooTallNate Fair point. Will have a look into that 馃憤
Going to close this as the fast-async functionality seems to be going to go into babel 7, which we use now for Next.js.
Most helpful comment
To implement this properly we just need to wrap the getInitialProps return value with
Promise.resolve(). (something likeawait Promise.resolve(this.getInitialProps())). It seems weird to me to rely on the parser for that behavior.