Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

multiple then not fulfilled #248

Closed
laoshu133 opened this issue Mar 30, 2016 · 5 comments
Closed

multiple then not fulfilled #248

laoshu133 opened this issue Mar 30, 2016 · 5 comments

Comments

@laoshu133
Copy link

var promise = Vue.Promise.resolve(1);
var x1;

promise.then(function (x) {
    x1 = x;
});

promise.then(function (x2) {
    console.log(x1 === x2, x1, x2);  // x2 is undefined
});
@Lidbetter
Copy link

Same issue.

Subsequent then's are called, however the response is undefined for all but the first then.

@maple-leaf
Copy link

confirmed here.

@steffans
Copy link
Member

This is implemented intentionally, currently the promise chain does not break. Means your example code will actually work like this. Since the first then does not return anything.

var promise = Vue.Promise.resolve(1);
var x1;

promise.then(function (x) {
    x1 = x;
}).then(function (x2) {
    console.log(x1 === x2, x1, x2);  // x2 is undefined
});

@laoshu133
Copy link
Author

This is useful, but sometimes I need to do some caching;
And this implemented does not follow "Promise A+".

@steffans
Copy link
Member

I removed this in the develop branch, will be released with v0.9

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

4 participants