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

question: what would it take to add stack traces to watch callbacks? #12606

bcherny opened this issue Aug 18, 2015 · 2 comments

question: what would it take to add stack traces to watch callbacks? #12606

bcherny opened this issue Aug 18, 2015 · 2 comments


Copy link

@bcherny bcherny commented Aug 18, 2015

when debugging reactive apps, a common issue is figuring out why a callback for an observable was erroneously fired.

with object.observe, devtools gives us async call stacks. with angular, there's no good tooling to help us figure out why something changed.

currently, my best solution is to put console.logs everywhere in my code where my model could have been modified. this only goes so far, since i can't instrument the view (html code) with logs, unless i add ng-change handlers everywhere as well. it's also a pita, and a lot of debugging overhead compared to working with non-reactive code.

my ideal solution would be a stack trace passed with every $watch fire, combined with something like rxjs' support for long stack traces:

scope.$watch('foo', (cur, prev, stack) => console.log(stack))
=> Update
  at (http://localhost:3001/foo.js:32:10)
  at (http://localhost:3001/foo.js:51:1)

afaik angular checks for changes at certain points in the app lifecycle, but doesn't know what caused those changes. in contrast with react or backbone's getter/setter architecture, with dirty checking this information is lost.

is there a cheap way to get this information back?

Copy link
Contributor Author

@bcherny bcherny commented Aug 20, 2015

Copy link

@petebacondarwin petebacondarwin commented Dec 7, 2015

I do not know of an easy way to add this feature. Is there anyone out there with any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants