Skip to content

Commit f809b79

Browse files
committed
Remove deprecated overwriting of options using computed properties
1 parent 37a5760 commit f809b79

File tree

3 files changed

+5
-75
lines changed

3 files changed

+5
-75
lines changed

addon/-private/deprecate-computed.js

-11
This file was deleted.

addon/services/apollo.js

+5-24
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { getOwner } from '@ember/application';
1414
import { isArray } from '@ember/array';
1515
import { isNone, isPresent } from '@ember/utils';
1616
import { registerWaiter } from '@ember/test';
17-
import deprecateComputed from 'ember-apollo-client/-private/deprecate-computed';
1817
import { run } from '@ember/runloop';
1918
import { QueryManager } from '../index';
2019

@@ -104,14 +103,7 @@ export default class ApolloService extends Service {
104103
init() {
105104
super.init(...arguments);
106105

107-
let options = this.clientOptions;
108-
if (typeof options === 'function') {
109-
options = this.clientOptions();
110-
} else {
111-
deprecateComputed('clientOptions');
112-
}
113-
114-
this.client = new ApolloClient(options);
106+
this.client = new ApolloClient(this.clientOptions());
115107

116108
if (Ember.testing) {
117109
this._registerWaiter();
@@ -155,21 +147,10 @@ export default class ApolloService extends Service {
155147
* @public
156148
*/
157149
clientOptions() {
158-
let { link, cache } = this;
159-
160-
if (typeof link === 'function') {
161-
link = this.link();
162-
} else {
163-
deprecateComputed('link');
164-
}
165-
166-
if (typeof cache === 'function') {
167-
cache = this.cache();
168-
} else {
169-
deprecateComputed('cache');
170-
}
171-
172-
return { link, cache };
150+
return {
151+
link: this.link(),
152+
cache: this.cache(),
153+
};
173154
}
174155

175156
/**

tests/unit/services/apollo-test.js

-40
Original file line numberDiff line numberDiff line change
@@ -163,46 +163,6 @@ module('Unit | Service | apollo', function (hooks) {
163163
removeListener(result, 'event', handleEvent);
164164
});
165165

166-
test('it works when cache and link are computed properties, deprecated computed', function (assert) {
167-
assert.expect(3);
168-
this.owner.register(
169-
'service:deprecated-overridden-apollo',
170-
ApolloService.extend({
171-
cache: computed(function () {
172-
assert.ok('should have called cache in computed');
173-
174-
return new InMemoryCache();
175-
}),
176-
link: computed(function () {
177-
assert.ok('should have called link in computed');
178-
179-
return createHttpLink({ uri: '/some-api', fetch });
180-
}),
181-
})
182-
);
183-
let service = this.owner.lookup('service:deprecated-overridden-apollo');
184-
185-
assert.ok(service);
186-
});
187-
188-
test('it works when clientOptions is a computed property, deprecated computed', function (assert) {
189-
this.owner.register(
190-
'service:client-options-overridden-apollo',
191-
ApolloService.extend({
192-
clientOptions: computed(function () {
193-
return {
194-
cache: this.cache(),
195-
link: fakeLink,
196-
};
197-
}),
198-
})
199-
);
200-
let service = this.owner.lookup('service:client-options-overridden-apollo');
201-
assert.ok(service);
202-
// make sure the override was used.
203-
assert.equal(service.client.link, fakeLink);
204-
});
205-
206166
test('tests should wait for response', async function (assert) {
207167
let service = this.owner.lookup('service:apollo');
208168

0 commit comments

Comments
 (0)