diff --git a/.eslintrc.js b/.eslintrc.js index 97b43305a6f..47cf65a2c36 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -79,6 +79,7 @@ module.exports = { WeakMap: true, Set: true, Promise: false, + Symbol: true, }, env: { browser: true, diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bdf195c5d03..3dfe5d6dc47 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -237,6 +237,8 @@ jobs: matrix: release: [ember-release, ember-beta] include: + - release: ember-release + continue-on-error: true - release: ember-beta continue-on-error: true runs-on: ubuntu-latest diff --git a/packages/-ember-data/addon/setup-container.js b/packages/-ember-data/addon/setup-container.js index 88c191d28ac..b8ec555886c 100644 --- a/packages/-ember-data/addon/setup-container.js +++ b/packages/-ember-data/addon/setup-container.js @@ -1,8 +1,12 @@ +import { getOwner } from '@ember/application'; import { deprecate } from '@ember/debug'; +import Route from '@ember/routing/route'; import { DEBUG } from '@glimmer/env'; import Store from '@ember-data/store'; +const EMBER_DATA_STORE = Symbol('ember-data-store'); + function initializeStore(application) { // we can just use registerOptionsForType when we no longer // support (deprecated) versions of @ember/test-helpers @@ -46,6 +50,21 @@ function initializeStore(application) { } } +// Implicit injection was removed. This is a replacement for Ember Route implicit store for >= v4.0 +Route.reopen({ + get store() { + if (this[EMBER_DATA_STORE]) { + return this[EMBER_DATA_STORE]; + } + + const store = getOwner(this).lookup('service:store'); + return store; + }, + set store(value) { + this[EMBER_DATA_STORE] = value; + }, +}); + export default function setupContainer(application) { initializeStore(application); }