Skip to content
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 generator vs syntax transform #851

Closed
sedubois opened this issue Jan 21, 2017 · 8 comments
Closed

async generator vs syntax transform #851

sedubois opened this issue Jan 21, 2017 · 8 comments

Comments

@sedubois
Copy link
Contributor

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?

@timneutkens
Copy link
Member

timneutkens commented Jan 24, 2017

Interesting. I'll benchmark changing this.

@timneutkens timneutkens self-assigned this Jan 24, 2017
@timneutkens
Copy link
Member

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.

@timneutkens
Copy link
Member

If there is something else we can look into please let me know 👍 😄

@sedubois
Copy link
Contributor Author

Thanks for looking that up. Would be good to give the feedback over there

@sedubois
Copy link
Contributor Author

@timneutkens I opened an issue over there and there are suggestions on how to fix your concerns: MatAtBread/fast-async#32 (comment)

@TooTallNate
Copy link
Member

So if you, for example make a component which has a static getInitialProps instead of static async getInitialProps it 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.

@timneutkens timneutkens reopened this Jan 30, 2017
@timneutkens
Copy link
Member

@TooTallNate Fair point. Will have a look into that 👍

@timneutkens timneutkens removed their assignment Jun 11, 2017
@timneutkens
Copy link
Member

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.

@lock lock bot locked as resolved and limited conversation to collaborators May 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants