relay-runtime 0.0.0-main-e8cbdbdf → 0.0.0-main-4f3d2d05
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.
- package/index.js +1 -1
- package/lib/store/RelayReader.js +12 -13
- package/package.json +1 -1
- package/relay-runtime.js +2 -2
- package/relay-runtime.min.js +2 -2
- package/store/RelayReader.js.flow +19 -14
|
@@ -183,13 +183,10 @@ class RelayReader {
|
|
|
183
183
|
// implement the interface. If we aren't sure whether the record implements
|
|
184
184
|
// the interface, that itself constitutes "expected" data being missing.
|
|
185
185
|
if (isDataExpectedToBePresent && abstractKey != null && record != null) {
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
typeRecord != null
|
|
191
|
-
? RelayModernRecord.getValue(typeRecord, abstractKey)
|
|
192
|
-
: null;
|
|
186
|
+
const implementsInterface = this._implementsInterface(
|
|
187
|
+
record,
|
|
188
|
+
abstractKey,
|
|
189
|
+
);
|
|
193
190
|
if (implementsInterface === false) {
|
|
194
191
|
// Type known to not implement the interface
|
|
195
192
|
isDataExpectedToBePresent = false;
|
|
@@ -375,13 +372,10 @@ class RelayReader {
|
|
|
375
372
|
const parentIsWithinUnmatchedTypeRefinement =
|
|
376
373
|
this._isWithinUnmatchedTypeRefinement;
|
|
377
374
|
|
|
378
|
-
const
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
typeRecord != null
|
|
383
|
-
? RelayModernRecord.getValue(typeRecord, abstractKey)
|
|
384
|
-
: null;
|
|
375
|
+
const implementsInterface = this._implementsInterface(
|
|
376
|
+
record,
|
|
377
|
+
abstractKey,
|
|
378
|
+
);
|
|
385
379
|
this._isWithinUnmatchedTypeRefinement =
|
|
386
380
|
parentIsWithinUnmatchedTypeRefinement ||
|
|
387
381
|
implementsInterface === false;
|
|
@@ -984,6 +978,17 @@ class RelayReader {
|
|
|
984
978
|
fields: [...this._missingRequiredFields.fields, ...additional.fields],
|
|
985
979
|
};
|
|
986
980
|
}
|
|
981
|
+
|
|
982
|
+
_implementsInterface(record: Record, abstractKey: string): ?boolean {
|
|
983
|
+
const typeName = RelayModernRecord.getType(record);
|
|
984
|
+
const typeRecord = this._recordSource.get(generateTypeID(typeName));
|
|
985
|
+
const implementsInterface =
|
|
986
|
+
typeRecord != null
|
|
987
|
+
? RelayModernRecord.getValue(typeRecord, abstractKey)
|
|
988
|
+
: null;
|
|
989
|
+
// $FlowFixMe Casting record value
|
|
990
|
+
return implementsInterface;
|
|
991
|
+
}
|
|
987
992
|
}
|
|
988
993
|
|
|
989
994
|
module.exports = {read};
|