-
Notifications
You must be signed in to change notification settings - Fork 23
core-list-dart, Think I might of found a problem with some index mismatches. #210
Description
Hi Guys
Hope this not a waste a time, but I think I might have found a problem with core-list. I have been about to reproduce it using the Core and PaperExamples.
Using 'polymer-core-and-paper-examples/web/core_list_dart/basic.dart' I lowered the number of TestItem it would initially produce. I did this by reducing count from 50000 to 5. So Now when I compile and run the example I just have five items on the screen.
Then I click the 'Add Row at Index' button, this just adds a TestItem to the top of the list. I continue to until to add the first generated TestItem moves off the screen. I then scroll up to bring that item back into view and then add another item. This is when I get:
Exception: The null object does not have a method '_addFromInteger'.
NoSuchMethodError: method not found: '_addFromInteger'
Receiver: null
Arguments: [1520]package:core_elements/core_list_dart.dart:1040 CoreList._positionItems@407177370package:core_elements/core_list_dart.dart:934 CoreList.<anonymous closure>
in the web console. If I continue with this behaviour, very quickly lose all the items in the list they disappear. I continue to receive the above message in the console
Repeating this various combination yields the same result. The only variation I have been able to notice is that if a allow all the TestItems which were initially generated to disappear off the screen before I scroll to bring the first one back into view. I get a range error.
Exception: Uncaught Error: RangeError: index (33) must be in the range [0..33)
Stack Trace:
#0 List.[] (dart:core-patch/growable_array.dart:136)
#1 CoreList._getFirstVisibleIndex (package:core_elements/core_list_dart.dart:1247:32)
#2 CoreList._adjustVirtualIndex (package:core_elements/core_list_dart.dart:328:19)
#3 CoreList.initialize (package:core_elements/core_list_dart.dart:376:9)
#4 Function._apply (dart:core-patch/function_patch.dart:7)
#5 Function.apply (dart:core-patch/function_patch.dart:28)
#6 GeneratedObjectAccessorService.invoke (package:smoke/static.dart:147:23)
#7 invoke (package:smoke/smoke.dart:43:6)
#8 HtmlElement&Polymer.observeArrayValue.<anonymous closure> (package:polymer/src/instance.dart:950:11)
#9 _RootZone.runUnaryGuarded (dart:async/zone.dart:1093)
#10 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341)
#11 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:270)
#12 _SyncBroadcastStreamController._sendData.<anonymous closure> (dart:async/broadcast_stream_controller.dart:370)
#13 _BroadcastStreamController._forEachListener (dart:async/broadcast_stream_controller.dart:312)
#14 _SyncBroadcastStreamController._sendData (dart:async/broadcast_stream_controller.dart:369)
#15 _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:237)
#16 ObservableList.deliverListChanges (package:observe/src/observable_list.dart:265:20)
#17 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#18 _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#19 _ScheduleImmediateHelper._handleMutation (dart:html:42407)
undefined:1 undefined
Again will the above all the TestItem quickly disappear out of view. I hope you can confirm this.....
Normally I just use core-list to present the user with a list of items and ask them select one. That works wells, because the list I pass in does not change. The use case that lead me to that above problem was a attaching the core-list model to a stream which was stream which was send events in burst, very quickly I was missing messages and needing to scroll back up to see the lastest one's and this is when this problem arose.
Any insights would be appreciated.
Ray.