Closed zoechi closed 8 years ago
Sounds like jsElement['matchingCandidates'] is null, can you confirm? If the dart/js lists got out of sync then I probably need a bit more context to figure out how that happened.
jsElement['matchingCandidates']
returns []
at the location where clear('matchingCandidates');
fails.
Sorry, forgot to add the link. Here is the full example (with a workaround and added TODOs where I run into the issue) https://github.com/bwu-dart-contributing/polymer-dart-patterns/blob/0.17.0/web/forms/implementing_simple_autocompletion/my_element.dart
I also forgot to mention that addAll('matchingCandidates', candidates);
also fails (with jsElement['matchingCandidates']
being []
)
Unhandled exception: TypeError: Cannot read property 'length' of undefined
0 JsObject._callMethod (dart:js:678)
1 JsObject.callMethod (dart:js:618)
2 HtmlElement&PolymerMixin&PolymerBase.addAll (package:polymer_interop/src/polymer_base.dart:324:15)
3 MyElement.Eval.
(evaluate:source:2:1) 4 MyElement.findCandidates.
(http://localhost:63342/polymer-dart-patterns/web/forms/implementing_simple_autocompletion/my_element.dart:105:7) 5 _RootZone.runUnary (dart:async/zone.dart:1165)
6 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:502)
7 _Future._propagateToListeners (dart:async/future_impl.dart:585)
8 _Future._completeWithValue (dart:async/future_impl.dart:376)
9 _Future._asyncComplete.
(dart:async/future_impl.dart:430) 10 _microtaskLoop (dart:async/schedule_microtask.dart:43)
11 _microtaskLoopEntry (dart:async/schedule_microtask.dart:52)
12 _ScheduleImmediateHelper._handleMutation (dart:html:42565)
This appears just to be related to using a final
field, without matchingCandidates
being marked as final both methods work (for me at least).
Also, fwiw this looks like its resolved in the no-proxy
branch which takes a pretty different approach to this sort of thing. That should be merged in the next few days.
This should be working fine on the 1.0.0-rc.1
branch.
The debugger shows this before the
clear('matchingCandidates');
line is executed: