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

Is v3.5.1 incompatible with v3.0.1? #1824

Closed
yodagg opened this issue Sep 3, 2020 · 2 comments
Closed

Is v3.5.1 incompatible with v3.0.1? #1824

yodagg opened this issue Sep 3, 2020 · 2 comments

Comments

@yodagg
Copy link

yodagg commented Sep 3, 2020

Version

3.5.1

Reproduction link

https://codepen.io/so-diao/pen/oNxGVvW

Steps to reproduce

https://codepen.io/so-diao/pen/oNxGVvW

What is expected?

What is actually happening?

I modified an old project package.json -> vuex: '^3.0.1' , npm i automatically downloaded the latest version (3.5.1) for me, but they are not compatible.

Why are incompatible changes occurring?

//  return jquery promise
actions: {
    fetch() {
        const Deferred = jQuery.Deferred()
        setTimeout(() =>{
            Deferred.resolve()
	}, 1500)
	return Deferred.promise()
    }
}

// v3.0.1 success
// v3.5.1 error
this.$store.dispatch('fetch').done(res =>{xxxxx})
@haoqunjiang
Copy link
Member

Just a quick note: it's introduced in #1740.
The jQuery promise is now wrapped inside a native Promise, whose keys are not enumerable.

I think the current implementation is more accurate because the documentation has always said the dispatch method "returns a Promise that resolves all triggered action handlers". https://vuex.vuejs.org/api/#dispatch

You should not have relied on the done method, which doesn't exist in the Promise/A+ spec.

@yodagg
Copy link
Author

yodagg commented Sep 14, 2020

It seems to be added by accident.
I see. Thank you @sodatea

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

No branches or pull requests

2 participants