material-input and material_dropdown_select generated from LinkedHashMap.entries are not editable

  • Dart SDK Version (dart --version)
    Dart VM version: 2.0.0 (Unknown timestamp) on “linux_x64”
  • Whether you are using Chrome, Safari, Firefox, Edge (if applicable)
    Reproduced with Firefox, Chrome and Chromium

Issue statement
A sequence of material-dropdown-select compoents fails to show the dropdown list when generated by ngFor over LinkedHashMap.entries. I.e. drop down selects generated as follow are not editable:

 <material-list-item *ngFor="let item of map.entries">
    <material-dropdown-select...>

The issue is even more evident for a simpler

 <material-list-item *ngFor="let item of map.entries">
    <material-input></material-input>

FWIW, The component material-dropdown-select works as expected when generated by ngFor over LinkedHashMap.values.

 <material-list-item *ngFor="let item of map.values">
    <material-dropdown-select>...

See https://github.com/pawsa/editablelist/blob/master/lib/test_component.html for a simple yet complete demo.

I would expect some diagnostics to be generated at the very least.

Author: Fantashit

1 thought on “material-input and material_dropdown_select generated from LinkedHashMap.entries are not editable

  1. Even subsequent iterations of the same map.entries may return a new MapEntry for the same key/value pair. You’d have to convert it to a list to be sure the values don’t change – that’s also a good recommendation any time you plan to use the same lazily computed iterable more than once.

    Also, even if Angular uses ==, MapEntry doesn’t override operator==.
    There is no natural equality on entries … or rather, that equality would be the map’s key-equality for the key and == for the value. We do not want each entry to carry a reference to the map class and a way to access its key equality.

Comments are closed.