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

Remove global Ember import #413

Merged
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
4 changes: 2 additions & 2 deletions addon/services/apollo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Ember from 'ember';
import { get, set, setProperties, defineProperty } from '@ember/object';
import { sendEvent } from '@ember/object/events';
import RSVP from 'rsvp';
Expand All @@ -17,6 +16,7 @@ import { run } from '@ember/runloop';
import { QueryManager } from '../index';
import { waitForPromise } from '@ember/test-waiters';
import { tracked } from '@glimmer/tracking';
import { isTesting } from '@embroider/macros';

const apolloObservableWeakMap = new WeakMap();
const apolloUnsubscribeWeakMap = new WeakMap();
Expand Down Expand Up @@ -137,7 +137,7 @@ export default class ApolloService extends Service {
let config = getOwner(this).resolveRegistration('config:environment');
if (config && config.apollo) {
return config.apollo;
} else if (Ember.testing) {
} else if (isTesting()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This could (should?) be combined with macroCondition(...), so the testing code is stripped out when isTesting() is false.

Copy link
Contributor

Choose a reason for hiding this comment

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

This could (should?) be combined with macroCondition(...), so the testing code is stripped out when isTesting() is false.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bertdeblock Thanks for pointing this out! I created another PR to address this: #416 /cc @josemarluedke

Copy link
Contributor

Choose a reason for hiding this comment

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

@balinterdi Sweet! 👍

return {
apiURL: 'http://testserver.example/v1/graph',
};
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"dependencies": {
"@apollo/client": "^3.2.1",
"@ember/test-waiters": "~3.0.0",
"@embroider/macros": "^1.5.0",
"@glimmer/tracking": "^1.0.2",
"broccoli-graphql-filter": "^1.0.0",
"ember-auto-import": "^1.6.0",
Expand All @@ -49,7 +50,7 @@
"broccoli-asset-rev": "^3.0.0",
"ember-cli": "~3.21.2",
"ember-cli-dependency-checker": "^3.2.0",
"ember-cli-htmlbars": "^5.3.1",
"ember-cli-htmlbars": "^5.7.2",
"ember-cli-inject-live-reload": "^2.0.2",
"ember-cli-terser": "^4.0.0",
"ember-compatibility-helpers": "^1.2.1",
Expand Down
Loading