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

Collection constructor should allow to set initial values #6319

Closed
mlewand opened this issue Feb 24, 2020 · 0 comments · Fixed by ckeditor/ckeditor5-utils#326
Closed

Collection constructor should allow to set initial values #6319

mlewand opened this issue Feb 24, 2020 · 0 comments · Fixed by ckeditor/ckeditor5-utils#326
Assignees
Labels
domain:dx This issue reports a developer experience problem or possible improvement. package:utils type:improvement This issue reports a possible enhancement of an existing feature.

Comments

@mlewand
Copy link
Contributor

mlewand commented Feb 24, 2020

📝 Provide a description of the improvement

Currently the only way to set collection value is to keep calling .add() for each value.

It should be possible to initialize it with an iterable object. That's both convenient and sometimes more efficient in terms of performance.

There's also a similar ticket asking to allow adding multiple values using .add() at once #4992.

📃 Other details

Required by #6194.

There's a nice PR that adds this together with the add() function which I'll base upon for solution to this issue - stripping stuff that is not needed for this fix.

  • Browser: Any
  • OS: Any

If you'd like to see this improvement implemented, add a 👍 reaction to this post.

@mlewand mlewand added the type:improvement This issue reports a possible enhancement of an existing feature. label Feb 24, 2020
@mlewand mlewand added this to the iteration 30 milestone Feb 24, 2020
@mlewand mlewand added domain:dx This issue reports a developer experience problem or possible improvement. package:utils labels Feb 24, 2020
@mlewand mlewand self-assigned this Feb 26, 2020
@Reinmar Reinmar modified the milestones: iteration 30, iteration 31 Mar 10, 2020
oleq added a commit to ckeditor/ckeditor5-utils that referenced this issue Mar 23, 2020
Feature: Added the support for initializing `Collection` items via the `constructor()`. Closes ckeditor/ckeditor5#6319.
oleq added a commit to ckeditor/ckeditor5-ui that referenced this issue Apr 6, 2020
Feature: Allowed defining initial items of `ViewCollection` and `BodyCollection` in the constructor. See ckeditor/ckeditor5#6319.

The `View#createCollection()` method also started accepting an iterator of views.

MAJOR BREAKING CHANGE: `ViewCollection` no longer has the `locale` property.

MAJOR BREAKING CHANGE: The `ViewCollection#constructor()` no longer accepts the `locale` as a parameter.
mlewand pushed a commit that referenced this issue May 1, 2020
Feature: Allowed defining initial items of `ViewCollection` and `BodyCollection` in the constructor. See #6319.

The `View#createCollection()` method also started accepting an iterator of views.

MAJOR BREAKING CHANGE: `ViewCollection` no longer has the `locale` property.

MAJOR BREAKING CHANGE: The `ViewCollection#constructor()` no longer accepts the `locale` as a parameter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:dx This issue reports a developer experience problem or possible improvement. package:utils type:improvement This issue reports a possible enhancement of an existing feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants