Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Watching inside a watched collection triggers a stacktrace #1046

Closed
chirayuk opened this issue May 14, 2014 · 3 comments
Closed

Watching inside a watched collection triggers a stacktrace #1046

chirayuk opened this issue May 14, 2014 · 3 comments
Milestone

Comments

@chirayuk
Copy link
Contributor

This doesn't cause any application level bugs but you will see stack traces in the DevTools console.  This bug is easier explained with an example.

HTML

<button ng-click="items.length > 0 && items.removeLast()">Remove Item</button><br>
<div ng-repeat="i in items"><input ng-model="items[$index]"></div>

Start with scope.context['items'] = ["A"] and click Remove Item once.  You'll see a stacktrace in Dartium's DevTools Console for a range error.

STACKTRACE

RangeError: 0

STACKTRACE:
#0      List.[] (dart:core-patch/growable_array.dart:168)
#1      _operation_bracket (package:angular/core/scope.dart:1235:57)
#2      Function.apply (dart:core-patch/function_patch.dart:28)
#3      _EvalWatchRecord.check (package:angular/change_detection/watch_group.dart:809:31)
#4      RootWatchGroup.detectChanges (package:angular/change_detection/watch_group.dart:425:29)
#5      RootScope.digest (package:angular/core/scope.dart:656:45)
#6      apply (package:angular/core/scope.dart:268:24)
#7      _rootRun (dart:async/zone.dart:723)
#8      _ZoneDelegate.run (dart:async/zone.dart:453)
#9      VmTurnZone._finishTurn (package:angular/core/zone.dart:150:21)
#10     VmTurnZone._onRunBase (package:angular/core/zone.dart:105:43)
#11     _onRunUnary (package:angular/core/zone.dart:114:17)
#12     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
#13     _CustomizedZone.runUnary (dart:async/zone.dart:667)
#14     _BaseZone.runUnaryGuarded (dart:async/zone.dart:582)
#15     _BaseZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:608)
@chirayuk
Copy link
Contributor Author

See https://github.com/chirayuk/sample/tree/ng_dart_issue_1046 for clonable repro.

We could simply suppress the exception on the .check() call and we won't see this exception anymore.

@mhevery
Copy link
Contributor

mhevery commented May 14, 2014

Assigned to @markovuksanovic

@chirayuk
Copy link
Contributor Author

@markovuksanovic Thanks for taking a stab at it.  Looking at the PR, I think watch_group.dart::check() is the wrong place for this fix.  We are really only concerned with the AST's that we've created. I think it should look like https://github.com/chirayuk/angular.dart/commit/31e4292c8a5be93ea1dab8634f8d2dd9bdb78ba6.  Would you update your PR to use that type of a fix and update your tests appropriately?  Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging a pull request may close this issue.

5 participants