ObservableList.sublist does not return an ObservableList #13965

Closed
DartBot opened this Issue Oct 10, 2013 · 9 comments

Comments

Projects
None yet
7 participants
@DartBot

DartBot commented Oct 10, 2013

This issue was originally filed by @butlermatt


This used to work correctly in web_ui, but as I port my project over to Polymer I'm finding that ObservableList.sublist() does not return an ObservableList. I instead have to wrap the return of sublist in toObservable.

eg:

// This throws an exception
ObservableList get items {
  if(_itemList.length < NUM_ROWS) return _itemList;
  return _itemList.sublist(0, NUM_ROWS);
}

Uncaught Error: type 'List' is not a subtype of type 'ObservableList' of 'function result'.

// This works
ObservableList get items {
  if(_itemList.length < NUM_ROWS) return _itemList;
  return toObservable(_itemList.sublist(0, NUM_ROWS));
}

@kasperl

This comment has been minimized.

Show comment Hide comment
@kasperl

kasperl Oct 14, 2013

Contributor

Added Area-Polymer, Triaged labels.

Contributor

kasperl commented Oct 14, 2013

Added Area-Polymer, Triaged labels.

@sigmundch

This comment has been minimized.

Show comment Hide comment
@sigmundch

sigmundch Oct 29, 2013

Member

Added this to the Later milestone.

Member

sigmundch commented Oct 29, 2013

Added this to the Later milestone.

@sigmundch

This comment has been minimized.

Show comment Hide comment
@sigmundch

sigmundch Nov 14, 2013

Member

Removed this from the Later milestone.
Added this to the M9 milestone.

Member

sigmundch commented Nov 14, 2013

Removed this from the Later milestone.
Added this to the M9 milestone.

@clayberg

This comment has been minimized.

Show comment Hide comment
@clayberg

clayberg Nov 15, 2013

Removed this from the M9 milestone.
Added this to the 1.1 milestone.

Removed this from the M9 milestone.
Added this to the 1.1 milestone.

@sigmundch

This comment has been minimized.

Show comment Hide comment
@sigmundch

sigmundch Jan 28, 2014

Member

Removed this from the 1.1 milestone.
Added this to the 1.2 milestone.

Member

sigmundch commented Jan 28, 2014

Removed this from the 1.1 milestone.
Added this to the 1.2 milestone.

@sigmundch

This comment has been minimized.

Show comment Hide comment
@sigmundch

sigmundch Feb 5, 2014

Member

Added Library-Observe label.

Member

sigmundch commented Feb 5, 2014

Added Library-Observe label.

@anders-sandholm

This comment has been minimized.

Show comment Hide comment
@anders-sandholm

anders-sandholm Feb 6, 2014

Member

Removed Library-Observe label.
Added Pkg-Observe label.

Member

anders-sandholm commented Feb 6, 2014

Removed Library-Observe label.
Added Pkg-Observe label.

@jmesserly

This comment has been minimized.

Show comment Hide comment
@jmesserly

jmesserly May 14, 2014

Member

we generally don't try to preserve observable-ness in all accessors, as that would greatly complicate ObservableList/Map impls. We'd need to know about every sublist, iterable, etc, and propagate change notifications. While it's a very neat idea and I support someone taking it on :-), we don't really have bandwidth. (and Object.observe in JS doesn't support it either, for similar reasons).

OTOH, if we fix https://code.google.com/p/dart/issues/detail?id=16342 it will essentially work again (using dirty checking like Web UI did).


Added NotPlanned label.

Member

jmesserly commented May 14, 2014

we generally don't try to preserve observable-ness in all accessors, as that would greatly complicate ObservableList/Map impls. We'd need to know about every sublist, iterable, etc, and propagate change notifications. While it's a very neat idea and I support someone taking it on :-), we don't really have bandwidth. (and Object.observe in JS doesn't support it either, for similar reasons).

OTOH, if we fix https://code.google.com/p/dart/issues/detail?id=16342 it will essentially work again (using dirty checking like Web UI did).


Added NotPlanned label.

@DartBot

This comment has been minimized.

Show comment Hide comment
@DartBot

DartBot Jun 5, 2015

This issue has been moved to dart-lang/observe#45.

DartBot commented Jun 5, 2015

This issue has been moved to dart-lang/observe#45.

This issue was closed.

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