Skip to content

[feat] Add asyncData Method Type to ComponentOptions Module Augmentation #1214

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

Closed
wants to merge 1 commit into from
Closed

[feat] Add asyncData Method Type to ComponentOptions Module Augmentation #1214

wants to merge 1 commit into from

Conversation

ryanmillerdev
Copy link

We use Vue SSR heavily at @algorithmiaio, and we've followed the Vue SSR-sanctioned means of declaring async data methods. We've shimmed together our own module augmentation for the asyncData method, but given the prevalence of asyncData usage throughout the Vue community, it would be nice to standardize the interface.

I was torn as per where this should live - there isn't a repo for SSR, given that it lives in the Vue repo, and ultimately it felt right here with the Vuex project, since asyncData and Vuex go hand in hand.

I've added a test for the new type as well, and let me know if there's anything I can tweak. Cheers!

@ktsn
Copy link
Member

ktsn commented Apr 4, 2018

Thanks for contribution. However this change is not appropriate for Vuex since asyncData is not a part of Vuex API. Also the asyncData implementation can be different among implementations and they can conflict if we have this type in Vuex. For example, Nuxt.js asyncData has its own context type.

Maybe, It should be stated how to augment asyncData type in the SSR docs.

@ktsn ktsn closed this Apr 4, 2018
@ryanmillerdev
Copy link
Author

Good call - thanks for taking a look!

@ktsn
Copy link
Member

ktsn commented Apr 4, 2018

I just opened an issue on SSR docs vuejs/vue2-ssr-docs#174

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants