relay-runtime 0.0.0-main-f16f5613 → 0.0.0-main-b898d72f
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/experimental.js +1 -1
- package/index.js +1 -1
- package/lib/store/ResolverCache.js +7 -0
- package/lib/store/experimental-live-resolvers/LiveResolverCache.js +7 -0
- package/lib/util/RelayFeatureFlags.js +2 -1
- package/package.json +1 -1
- package/relay-runtime-experimental.js +1 -1
- package/relay-runtime-experimental.min.js +1 -1
- package/relay-runtime.js +2 -2
- package/relay-runtime.min.js +2 -2
- package/store/RelayErrorTrie.js.flow +1 -0
- package/store/RelayPublishQueue.js.flow +1 -0
- package/store/ResolverCache.js.flow +17 -0
- package/store/experimental-live-resolvers/LiveResolverCache.js.flow +17 -0
- package/util/RelayFeatureFlags.js.flow +4 -0
|
@@ -210,6 +210,7 @@ class RelayPublishQueue implements PublishQueue {
|
|
|
210
210
|
sourceOperation?: OperationDescriptor,
|
|
211
211
|
): $ReadOnlyArray<RequestDescriptor> {
|
|
212
212
|
const runWillClearGcHold =
|
|
213
|
+
// $FlowFixMe[incompatible-type]
|
|
213
214
|
this._appliedOptimisticUpdates === 0 && !!this._gcHold;
|
|
214
215
|
const runIsANoop =
|
|
215
216
|
// this._pendingBackupRebase is true if an applied optimistic
|
|
@@ -26,6 +26,7 @@ import type {
|
|
|
26
26
|
|
|
27
27
|
const recycleNodesInto = require('../util/recycleNodesInto');
|
|
28
28
|
const {RELAY_LIVE_RESOLVER} = require('../util/RelayConcreteNode');
|
|
29
|
+
const RelayFeatureFlags = require('../util/RelayFeatureFlags');
|
|
29
30
|
const shallowFreeze = require('../util/shallowFreeze');
|
|
30
31
|
const {generateClientID} = require('./ClientID');
|
|
31
32
|
const RelayModernRecord = require('./RelayModernRecord');
|
|
@@ -325,6 +326,22 @@ class RecordResolverCache implements ResolverCache {
|
|
|
325
326
|
if (recycled !== originalInputs) {
|
|
326
327
|
return true;
|
|
327
328
|
}
|
|
329
|
+
|
|
330
|
+
if (RelayFeatureFlags.MARK_RESOLVER_VALUES_AS_CLEAN_AFTER_FRAGMENT_REREAD) {
|
|
331
|
+
// This record does not need to be recomputed, we can reuse the cached value.
|
|
332
|
+
// For subsequent reads we can mark this record as "clean" so that they will
|
|
333
|
+
// not need to re-read the fragment.
|
|
334
|
+
const nextRecord = RelayModernRecord.clone(record);
|
|
335
|
+
RelayModernRecord.setValue(
|
|
336
|
+
nextRecord,
|
|
337
|
+
RELAY_RESOLVER_INVALIDATION_KEY,
|
|
338
|
+
false,
|
|
339
|
+
);
|
|
340
|
+
|
|
341
|
+
const recordSource = this._getRecordSource();
|
|
342
|
+
recordSource.set(RelayModernRecord.getDataID(record), nextRecord);
|
|
343
|
+
}
|
|
344
|
+
|
|
328
345
|
return false;
|
|
329
346
|
}
|
|
330
347
|
|
|
@@ -35,6 +35,7 @@ import type {LiveState} from 'relay-runtime';
|
|
|
35
35
|
|
|
36
36
|
const recycleNodesInto = require('../../util/recycleNodesInto');
|
|
37
37
|
const {RELAY_LIVE_RESOLVER} = require('../../util/RelayConcreteNode');
|
|
38
|
+
const RelayFeatureFlags = require('../../util/RelayFeatureFlags');
|
|
38
39
|
const shallowFreeze = require('../../util/shallowFreeze');
|
|
39
40
|
const {generateClientID, generateClientObjectClientID} = require('../ClientID');
|
|
40
41
|
const RelayModernRecord = require('../RelayModernRecord');
|
|
@@ -699,6 +700,22 @@ class LiveResolverCache implements ResolverCache {
|
|
|
699
700
|
if (recycled !== originalInputs) {
|
|
700
701
|
return true;
|
|
701
702
|
}
|
|
703
|
+
|
|
704
|
+
if (RelayFeatureFlags.MARK_RESOLVER_VALUES_AS_CLEAN_AFTER_FRAGMENT_REREAD) {
|
|
705
|
+
// This record does not need to be recomputed, we can reuse the cached value.
|
|
706
|
+
// For subsequent reads we can mark this record as "clean" so that they will
|
|
707
|
+
// not need to re-read the fragment.
|
|
708
|
+
const nextRecord = RelayModernRecord.clone(record);
|
|
709
|
+
RelayModernRecord.setValue(
|
|
710
|
+
nextRecord,
|
|
711
|
+
RELAY_RESOLVER_INVALIDATION_KEY,
|
|
712
|
+
false,
|
|
713
|
+
);
|
|
714
|
+
|
|
715
|
+
const recordSource = this._getRecordSource();
|
|
716
|
+
recordSource.set(RelayModernRecord.getDataID(record), nextRecord);
|
|
717
|
+
}
|
|
718
|
+
|
|
702
719
|
return false;
|
|
703
720
|
}
|
|
704
721
|
|
|
@@ -48,6 +48,9 @@ export type FeatureFlags = {
|
|
|
48
48
|
ENABLE_FIELD_ERROR_HANDLING_CATCH_DIRECTIVE: boolean,
|
|
49
49
|
|
|
50
50
|
PROCESS_OPTIMISTIC_UPDATE_BEFORE_SUBSCRIPTION: boolean,
|
|
51
|
+
|
|
52
|
+
// Temporary flag to enable a gradual rollout of the fix for T185969900
|
|
53
|
+
MARK_RESOLVER_VALUES_AS_CLEAN_AFTER_FRAGMENT_REREAD: boolean,
|
|
51
54
|
};
|
|
52
55
|
|
|
53
56
|
const RelayFeatureFlags: FeatureFlags = {
|
|
@@ -71,6 +74,7 @@ const RelayFeatureFlags: FeatureFlags = {
|
|
|
71
74
|
ENABLE_FIELD_ERROR_HANDLING_THROW_BY_DEFAULT: false,
|
|
72
75
|
ENABLE_FIELD_ERROR_HANDLING_CATCH_DIRECTIVE: false,
|
|
73
76
|
PROCESS_OPTIMISTIC_UPDATE_BEFORE_SUBSCRIPTION: false,
|
|
77
|
+
MARK_RESOLVER_VALUES_AS_CLEAN_AFTER_FRAGMENT_REREAD: false,
|
|
74
78
|
};
|
|
75
79
|
|
|
76
80
|
module.exports = RelayFeatureFlags;
|