@ember-data/store 4.11.2 → 4.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -37,7 +37,7 @@ import { assertIdentifierHasId } from '../store-service';
|
|
|
37
37
|
import coerceId, { ensureStringId } from '../utils/coerce-id';
|
|
38
38
|
import constructResource from '../utils/construct-resource';
|
|
39
39
|
import normalizeModelName from '../utils/normalize-model-name';
|
|
40
|
-
import { removeRecordDataFor, setRecordDataFor } from './record-data-for';
|
|
40
|
+
import { RecordDataForIdentifierCache, removeRecordDataFor, setRecordDataFor } from './record-data-for';
|
|
41
41
|
|
|
42
42
|
let _peekGraph: peekGraph;
|
|
43
43
|
if (HAS_RECORD_DATA_PACKAGE) {
|
|
@@ -237,6 +237,10 @@ export class InstanceCache {
|
|
|
237
237
|
let record = this.__instances.record.get(identifier);
|
|
238
238
|
|
|
239
239
|
if (!record) {
|
|
240
|
+
assert(
|
|
241
|
+
`Cannot create a new record instance while the store is being destroyed`,
|
|
242
|
+
!this.store.isDestroying && !this.store.isDestroyed
|
|
243
|
+
);
|
|
240
244
|
const recordData = this.getRecordData(identifier);
|
|
241
245
|
|
|
242
246
|
record = this.store.instantiateRecord(
|
|
@@ -693,3 +697,9 @@ function _isLoading(cache: InstanceCache, identifier: StableRecordIdentifier): b
|
|
|
693
697
|
req.getPendingRequestsForRecord(identifier).some((req) => req.type === 'query')
|
|
694
698
|
);
|
|
695
699
|
}
|
|
700
|
+
|
|
701
|
+
export function _clearCaches() {
|
|
702
|
+
RecordCache.clear();
|
|
703
|
+
StoreMap.clear();
|
|
704
|
+
RecordDataForIdentifierCache.clear();
|
|
705
|
+
}
|
|
@@ -9,7 +9,7 @@ import type { RecordInstance } from '@ember-data/types/q/record-instance';
|
|
|
9
9
|
* Model or Identifier
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const RecordDataForIdentifierCache = new Map<StableRecordIdentifier | RecordInstance, RecordData>();
|
|
12
|
+
export const RecordDataForIdentifierCache = new Map<StableRecordIdentifier | RecordInstance, RecordData>();
|
|
13
13
|
|
|
14
14
|
export function setRecordDataFor(identifier: StableRecordIdentifier | RecordInstance, recordData: RecordData): void {
|
|
15
15
|
assert(
|
package/addon/-private/index.ts
CHANGED
|
@@ -57,4 +57,5 @@ export { default as RecordArrayManager, fastPush } from './managers/record-array
|
|
|
57
57
|
export { default as SnapshotRecordArray } from './network/snapshot-record-array';
|
|
58
58
|
|
|
59
59
|
// leaked for private use / test use, should investigate removing
|
|
60
|
+
export { _clearCaches } from './caches/instance-cache';
|
|
60
61
|
export { default as recordDataFor, removeRecordDataFor } from './caches/record-data-for';
|
|
@@ -135,7 +135,7 @@ export function promiseArray<I, T extends EmberArrayLike<I>>(promise: Promise<T>
|
|
|
135
135
|
return Reflect.get(target, prop, receiver);
|
|
136
136
|
}
|
|
137
137
|
if (ALLOWABLE_PROPS.includes(prop)) {
|
|
138
|
-
return
|
|
138
|
+
return target[prop];
|
|
139
139
|
}
|
|
140
140
|
if (!ALLOWABLE_METHODS.includes(prop)) {
|
|
141
141
|
deprecate(
|
|
@@ -190,7 +190,7 @@ export function promiseObject<T>(promise: Promise<T>): PromiseObjectProxy<T> {
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
if (ALLOWABLE_PROPS.includes(prop)) {
|
|
193
|
-
return
|
|
193
|
+
return target[prop];
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
if (!ALLOWABLE_METHODS.includes(prop)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-data/store",
|
|
3
|
-
"version": "4.11.
|
|
3
|
+
"version": "4.11.3",
|
|
4
4
|
"description": "The core of EmberData. Provides the Store service which coordinates the cache with the network and presentation layers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"author": "",
|
|
15
15
|
"directories": {},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@ember-data/model": "4.11.
|
|
18
|
-
"@ember-data/record-data": "4.11.
|
|
19
|
-
"@ember-data/tracking": "4.11.
|
|
17
|
+
"@ember-data/model": "4.11.3",
|
|
18
|
+
"@ember-data/record-data": "4.11.3",
|
|
19
|
+
"@ember-data/tracking": "4.11.3",
|
|
20
20
|
"@ember/string": "^3.0.1",
|
|
21
21
|
"@glimmer/tracking": "^1.1.2"
|
|
22
22
|
},
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@ember-data/canary-features": "4.11.
|
|
41
|
-
"@ember-data/private-build-infra": "4.11.
|
|
40
|
+
"@ember-data/canary-features": "4.11.3",
|
|
41
|
+
"@ember-data/private-build-infra": "4.11.3",
|
|
42
42
|
"@embroider/macros": "^1.10.0",
|
|
43
43
|
"ember-auto-import": "^2.4.3",
|
|
44
44
|
"ember-cached-decorator-polyfill": "^1.0.1",
|