Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ObservableList.sublist does not return an ObservableList #13965

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

ObservableList.sublist does not return an ObservableList #13965

DartBot opened this issue Oct 10, 2013 · 9 comments
Labels
closed-not-planned Closed as we don't intend to take action on the reported issue
Milestone

Comments

@DartBot
Copy link

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
Copy link

kasperl commented Oct 14, 2013

Added Area-Polymer, Triaged labels.

@sigmundch
Copy link
Member

Added this to the Later milestone.

@sigmundch
Copy link
Member

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

@clayberg
Copy link

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

@sigmundch
Copy link
Member

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

@sigmundch
Copy link
Member

Added Library-Observe label.

@anders-sandholm
Copy link
Contributor

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

@jmesserly
Copy link

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 DartBot added Type-Defect closed-not-planned Closed as we don't intend to take action on the reported issue labels May 14, 2014
@DartBot DartBot added this to the 1.2 milestone May 14, 2014
@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

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

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-not-planned Closed as we don't intend to take action on the reported issue
Projects
None yet
Development

No branches or pull requests

7 participants