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

Must be able to detect chaining cycle #112

Open
amasad opened this issue Oct 1, 2015 · 3 comments
Open

Must be able to detect chaining cycle #112

amasad opened this issue Oct 1, 2015 · 3 comments

Comments

@amasad
Copy link

amasad commented Oct 1, 2015

Both native promises in Chrome and Bluebird has that.

screenshot 2015-10-01 16 29 58

@amasad
Copy link
Author

amasad commented Oct 2, 2015

Actually, nvm, you do detect it (it's just there is no uncaught error warning). My issue turns out is that I'm calling then before I return the chained promise:

var b = Promise.resolve().then(function() {return b.then(function() {return 1;})});

This obviously, never finishes, yet it's not detected.

@ForbesLindesay
Copy link
Member

Indeed, your original example is covered by the Promises/A+ test suite, so we definitely detect that.

The later example is (as discussed on twitter) vastly more complex to actually detect. If you think it's worth while, we could look into adding more advanced cycle detection, as long as we do it in a way that can be stripped out for production, i.e.

  • all work is done in if (process.env.NODE_ENV !== 'production') so that there is no performance impact in production.
  • It can only log/warn for errors, it must not reject any promises that would otherwise be fulfilled.

@amasad
Copy link
Author

amasad commented Oct 2, 2015

This sounds great. Cycles are incredibly hard to debug. Let me know how I can help

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