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

[BUGFIX beta] avoid ordered set deprecation #16709

Merged
merged 1 commit into from
Jun 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions packages/@ember/map/lib/ordered-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ import { copyNull } from './utils';
@constructor
@private
*/
export default class OrderedSet {
constructor() {
deprecate('Use of @ember/OrderedSet is deprecated. Please use native `Map` instead', false, {
id: 'ember-map-deprecation',
until: '3.5.0',
});

/**
* This is exported so it can be used by the OrderedSet library.
* This is private do not use it.
@private
*/

export class __OrderedSet__ {
constructor() {
this.clear();
}

/**
@method create
@static
Expand Down Expand Up @@ -166,3 +167,13 @@ export default class OrderedSet {
return set;
}
}

export default class OrderedSet extends __OrderedSet__ {
constructor() {
super();
deprecate('Use of @ember/OrderedSet is deprecated. Please use native `Map` instead', false, {
Copy link
Contributor

@bekzod bekzod Jun 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe it should say, Please use native Map or ember-ordered-set addon instead ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or "Please use native Map or https://github.com/emberjs/ember-ordered-set addon instead"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good idea and can be a followup PR

id: 'ember-map-deprecation',
until: '3.5.0',
});
}
}
12 changes: 11 additions & 1 deletion packages/@ember/map/tests/map_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Map from '..';
import MapWithDefault from '../with-default';
import OrderedSet from '../lib/ordered-set';
import OrderedSet, { __OrderedSet__ } from '../lib/ordered-set';
import { moduleFor, AbstractTestCase } from 'internal-test-helpers';

let object, number, string, map, variety;
Expand Down Expand Up @@ -566,3 +566,13 @@ moduleFor(
}
}
);

moduleFor(
'__OrderedSet__',
class extends AbstractTestCase {
['@test private __OrderedSet__ can be created without deprecation']() {
expectNoDeprecation();
__OrderedSet__.create();
}
}
);
3 changes: 2 additions & 1 deletion packages/ember/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ import Engine from '@ember/engine';
import EngineInstance from '@ember/engine/instance';
import Map from '@ember/map';
import MapWithDefault from '@ember/map/with-default';
import OrderedSet from '@ember/map/lib/ordered-set';
import OrderedSet, { __OrderedSet__ } from '@ember/map/lib/ordered-set';
import { assign, merge } from '@ember/polyfills';
import {
PROPERTY_WILL_CHANGE,
Expand Down Expand Up @@ -183,6 +183,7 @@ Ember.EngineInstance = EngineInstance;

// ****@ember/map****
Ember.OrderedSet = OrderedSet;
Ember.__OrderedSet__ = __OrderedSet__;
Ember.Map = Map;
Ember.MapWithDefault = MapWithDefault;

Expand Down