From c178c64be02879c00bd3d345bfe4d728987ddd3b Mon Sep 17 00:00:00 2001 From: Igor Terzic Date: Wed, 3 Nov 2021 17:04:50 -0700 Subject: [PATCH] =?UTF-8?q?[cleanup]:=20Remove=20implicit=20store=20inject?= =?UTF-8?q?ion=20slated=20for=20Ember=20v4.0.0=20(#=E2=80=A6=20(#7736)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [cleanup]: Remove implicit store injection slated for Ember v4.0.0 (#7667) * CI timeouts testing bump (#7734) Co-authored-by: Scott Newcomer --- .github/workflows/main.yml | 18 ++++----- packages/-ember-data/addon/setup-container.js | 7 ---- .../app/initializers/ember-data.js | 3 -- .../tests/integration/injection-test.js | 37 ------------------- .../app/routes/index.js | 3 ++ .../app/routes/person/new.js | 8 ++-- .../app/routes/add-children.js | 3 ++ .../app/routes/destroy.js | 3 ++ .../app/routes/materialization.js | 3 ++ .../app/routes/unload.js | 3 ++ .../app/routes/unused-relationships.js | 3 ++ 11 files changed, 31 insertions(+), 60 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e05f0a828a3..b2db912bf62 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,7 +31,7 @@ jobs: run: yarn problems test-infra: - timeout-minutes: 8 + timeout-minutes: 10 runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -138,12 +138,12 @@ jobs: - name: Install dependencies run: yarn install --frozen-lockfile --network-timeout=300000 - name: Fastboot Test ${{ matrix.scenario }} - timeout-minutes: 6 + timeout-minutes: 12 run: yarn test:fastboot ${{ matrix.scenario }} browser-tests: needs: [lint] - timeout-minutes: 20 + timeout-minutes: 20 strategy: fail-fast: false matrix: @@ -175,7 +175,7 @@ jobs: run: | yarn run testem launchers - name: Run Production Test - timeout-minutes: 8 + timeout-minutes: 10 env: TESTEM_CI_LAUNCHER: ${{ matrix.launcher }} CI: true @@ -183,7 +183,7 @@ jobs: yarn test:production floating-dependencies: - timeout-minutes: 6 + timeout-minutes: 10 needs: [lint, basic-tests] runs-on: ubuntu-latest steps: @@ -211,13 +211,13 @@ jobs: - name: Install dependencies run: yarn install - name: Basic tests with ${{ matrix.scenario }} - timeout-minutes: 6 + timeout-minutes: 10 env: CI: true run: yarn test:try-one ${{ matrix.scenario }} releases: - timeout-minutes: 6 + timeout-minutes: 10 needs: [lint, basic-tests] if: | github.event_name == 'pull_request' && ( @@ -247,7 +247,7 @@ jobs: continue-on-error: ${{ matrix['continue-on-error'] == true }} additional-scenarios: - timeout-minutes: 7 + timeout-minutes: 8 needs: [lint, basic-tests] strategy: matrix: @@ -274,7 +274,7 @@ jobs: node-version-test: name: Use Node.js ${{ matrix.node-version }} - timeout-minutes: 6 + timeout-minutes: 8 needs: [lint, basic-tests] runs-on: ubuntu-latest strategy: diff --git a/packages/-ember-data/addon/setup-container.js b/packages/-ember-data/addon/setup-container.js index c951048d650..88c191d28ac 100644 --- a/packages/-ember-data/addon/setup-container.js +++ b/packages/-ember-data/addon/setup-container.js @@ -46,13 +46,6 @@ function initializeStore(application) { } } -function initializeStoreInjections(application) { - let inject = application.inject || application.injection; - inject.call(application, 'controller', 'store', 'service:store'); - inject.call(application, 'route', 'store', 'service:store'); -} - export default function setupContainer(application) { - initializeStoreInjections(application); initializeStore(application); } diff --git a/packages/-ember-data/app/initializers/ember-data.js b/packages/-ember-data/app/initializers/ember-data.js index cb1ab864039..a3dd9a3a6f5 100644 --- a/packages/-ember-data/app/initializers/ember-data.js +++ b/packages/-ember-data/app/initializers/ember-data.js @@ -4,9 +4,6 @@ import setupContainer from 'ember-data/setup-container'; /* This code initializes EmberData in an Ember application. - - It ensures that the `store` service is automatically injected - as the `store` property on all routes and controllers. */ export default { name: 'ember-data', diff --git a/packages/-ember-data/tests/integration/injection-test.js b/packages/-ember-data/tests/integration/injection-test.js index 7927c633461..1dee9ff4fc0 100644 --- a/packages/-ember-data/tests/integration/injection-test.js +++ b/packages/-ember-data/tests/integration/injection-test.js @@ -1,11 +1,7 @@ -import Service from '@ember/service'; - import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -import Model from '@ember-data/model'; - module('integration/injection factoryFor enabled', function (hooks) { setupTest(hooks); let store; @@ -36,36 +32,3 @@ module('integration/injection factoryFor enabled', function (hooks) { assert.equal(modelClass.modelName, 'super-villain', 'expected the factory itself to be returned'); }); }); - -module('integration/injection eager injections', function (hooks) { - setupTest(hooks); - let store; - let Apple = Service.extend(); - - hooks.beforeEach(function () { - let { owner } = this; - - owner.register('model:foo', Model.extend()); - owner.register('service:apple', Apple); - owner.inject('model:foo', 'apple', 'service:apple'); - - store = this.owner.lookup('service:store'); - }); - - test('did inject', async function (assert) { - // TODO likely this test should instead test that we can use service injections - // on models (e.g. that owner is properly setup for it). - assert.expectDeprecation( - () => { - let foo = store.createRecord('foo'); - let apple = foo.get('apple'); - let appleService = this.owner.lookup('service:apple'); - - assert.ok(apple, `'model:foo' instance should have an 'apple' property`); - assert.ok(apple === appleService, `'model:foo.apple' should be the apple service`); - assert.ok(apple instanceof Apple, `'model:foo'.apple should be an instance of 'service:apple'`); - }, - { id: 'implicit-injections', count: 1, when: { ember: '>=3.27.0' } } - ); - }); -}); diff --git a/packages/unpublished-fastboot-test-app/app/routes/index.js b/packages/unpublished-fastboot-test-app/app/routes/index.js index e3acdc673f2..0d6b04c414e 100644 --- a/packages/unpublished-fastboot-test-app/app/routes/index.js +++ b/packages/unpublished-fastboot-test-app/app/routes/index.js @@ -1,8 +1,11 @@ import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; import { buildTree } from 'ember-simple-tree/utils/tree'; export default class IndexRoute extends Route { + @service store; + model() { return this.store.findAll('person'); } diff --git a/packages/unpublished-fastboot-test-app/app/routes/person/new.js b/packages/unpublished-fastboot-test-app/app/routes/person/new.js index 29d4d380b62..6ffdece4ee8 100644 --- a/packages/unpublished-fastboot-test-app/app/routes/person/new.js +++ b/packages/unpublished-fastboot-test-app/app/routes/person/new.js @@ -1,10 +1,10 @@ import Route from '@ember/routing/route'; import { inject as service } from '@ember/service'; -export default Route.extend({ - store: service(), +export default class PersonNewRoute extends Route { + @service store; model() { return this.store.createRecord('person'); - }, -}); + } +} diff --git a/packages/unpublished-relationship-performance-test-app/app/routes/add-children.js b/packages/unpublished-relationship-performance-test-app/app/routes/add-children.js index 5ace63e810b..84988578a6b 100644 --- a/packages/unpublished-relationship-performance-test-app/app/routes/add-children.js +++ b/packages/unpublished-relationship-performance-test-app/app/routes/add-children.js @@ -1,6 +1,9 @@ import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; export default Route.extend({ + store: service(), + async model() { performance.mark('start-data-generation'); diff --git a/packages/unpublished-relationship-performance-test-app/app/routes/destroy.js b/packages/unpublished-relationship-performance-test-app/app/routes/destroy.js index ebbc3f2472c..43844da8fcf 100644 --- a/packages/unpublished-relationship-performance-test-app/app/routes/destroy.js +++ b/packages/unpublished-relationship-performance-test-app/app/routes/destroy.js @@ -1,8 +1,11 @@ import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; import { all } from 'rsvp'; export default Route.extend({ + store: service(), + async model() { performance.mark('start-data-generation'); const payload = await fetch('./fixtures/destroy.json').then((r) => r.json()); diff --git a/packages/unpublished-relationship-performance-test-app/app/routes/materialization.js b/packages/unpublished-relationship-performance-test-app/app/routes/materialization.js index a9540956a0f..4db26a33265 100644 --- a/packages/unpublished-relationship-performance-test-app/app/routes/materialization.js +++ b/packages/unpublished-relationship-performance-test-app/app/routes/materialization.js @@ -1,6 +1,9 @@ import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; export default Route.extend({ + store: service(), + model() { performance.mark('start-find-all'); return this.store.findAll('car', { reload: true }).then((cars) => { diff --git a/packages/unpublished-relationship-performance-test-app/app/routes/unload.js b/packages/unpublished-relationship-performance-test-app/app/routes/unload.js index 3b149a1e4ef..2973255a6bb 100644 --- a/packages/unpublished-relationship-performance-test-app/app/routes/unload.js +++ b/packages/unpublished-relationship-performance-test-app/app/routes/unload.js @@ -1,7 +1,10 @@ import Route from '@ember/routing/route'; import { run } from '@ember/runloop'; +import { inject as service } from '@ember/service'; export default Route.extend({ + store: service(), + async model() { performance.mark('start-data-generation'); const payload = await fetch('./fixtures/unload.json').then((r) => r.json()); diff --git a/packages/unpublished-relationship-performance-test-app/app/routes/unused-relationships.js b/packages/unpublished-relationship-performance-test-app/app/routes/unused-relationships.js index 15748532f13..5c3d278119f 100644 --- a/packages/unpublished-relationship-performance-test-app/app/routes/unused-relationships.js +++ b/packages/unpublished-relationship-performance-test-app/app/routes/unused-relationships.js @@ -1,10 +1,13 @@ import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; /** * Measures the performance characteristics of pushing a large payload * with tons of relationship data that will not be accessed. */ export default class UnusedRelationshipsRoute extends Route { + @service store; + async model() { performance.mark('start-data-generation');