mootools / mootools-core

MooTools Core Repository
https://mootools.net
2.65k stars 505 forks source link

Perplexing Request/Thenable/then Behavior #2775

Open CNSKnight opened 7 years ago

CNSKnight commented 7 years ago

v1.5.2 Two issues: I intermittently get a thenable back from Request w/no .then method?

r = new Request.JSON({url: 'https://someplace.net/api/'})
Object {$chain: Array[0], $events: F, options: Object, $caller: null, $family: null…}
r.then
undefined

When it accepts the .then, neither callback applied ever gets called?

r = new Request({url: ..., onFailure: ...);
r.then(success, failure); // neither gets called even on a 200 response
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/38800465-perplexing-request-thenable-then-behavior?utm_campaign=plugin&utm_content=tracker%2F22067&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F22067&utm_medium=issues&utm_source=github).
timwienk commented 7 years ago

v1.5.2

I think there is a mixup somewhere, Class.Thenable was introduced in 1.6.0. So if you're using 1.5.2, the Request.JSON classes won't inherit from the Class.Thenable mixin since it doesn't exist yet.

Could you check again? Could it be that multiple versions are loaded and a race condition makes for the inconsistent behaviour?

In case it helps: