Relay runtime: fix Store options (#42152)

Related change in Relay: https://github.com/facebook/relay/commit/6ed264413ba8cdd586d695e5ed234951ee9eca13
This commit is contained in:
Martin Zlámal
2020-02-07 13:11:52 -08:00
committed by GitHub
parent abcf09cba4
commit fd6a6b6b9a
3 changed files with 19 additions and 2 deletions
+1
View File
@@ -5,6 +5,7 @@
// Cameron Knight <https://github.com/ckknight>
// Renan Machado <https://github.com/renanmav>
// Stephen Pittman <https://github.com/Stephen2>
// Martin Zlámal <https://github.com/mrtnzlml>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0
+5 -2
View File
@@ -7,7 +7,6 @@ import {
OperationAvailability,
OperationDescriptor,
RecordSource,
NormalizationSelector,
ReaderSelector,
Snapshot,
RequestDescriptor,
@@ -22,7 +21,11 @@ import {
} from './RelayConnection';
export class RelayModernStore implements Store {
constructor(source: MutableRecordSource, gcScheduler?: Scheduler, operationLoader?: OperationLoader | null);
constructor(source: MutableRecordSource, options?: {
gcScheduler?: Scheduler | null,
operationLoader?: OperationLoader | null,
gcReleaseBufferSize?: number | null,
});
getSource(): RecordSource;
check(operation: OperationDescriptor, options?: CheckOptions): OperationAvailability;
retain(operation: OperationDescriptor): Disposable;
@@ -16,6 +16,19 @@ import {
const source = new RecordSource();
const store = new Store(source);
const storeWithNullOptions = new Store(source, {
gcScheduler: null,
operationLoader: null,
gcReleaseBufferSize: null,
});
const storeWithOptions = new Store(source, {
gcScheduler: () => undefined,
operationLoader: {
get: () => null,
load: () => Promise.resolve(null),
},
gcReleaseBufferSize: 10,
});
// ~~~~~~~~~~~~~~~~~~~~~
// Network Layer