react-relay
Advanced tools
Comparing version
/** | ||
* Relay v0.0.0-main-ad262841 | ||
* Relay v0.0.0-main-ad4b15c9 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Meta Platforms, Inc. and affiliates. |
/** | ||
* Relay v0.0.0-main-ad262841 | ||
* Relay v0.0.0-main-ad4b15c9 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Meta Platforms, Inc. and affiliates. |
/** | ||
* Relay v0.0.0-main-ad262841 | ||
* Relay v0.0.0-main-ad4b15c9 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Meta Platforms, Inc. and affiliates. |
@@ -21,2 +21,3 @@ 'use strict'; | ||
var usePaginationFragment = require('./relay-hooks/usePaginationFragment'); | ||
var usePrefetchableForwardPaginationFragment = require('./relay-hooks/usePrefetchableForwardPaginationFragment'); | ||
var usePreloadedQuery = require('./relay-hooks/usePreloadedQuery'); | ||
@@ -61,2 +62,3 @@ var useQueryLoader = require('./relay-hooks/useQueryLoader'); | ||
useRefetchableFragment: useRefetchableFragment, | ||
usePrefetchableForwardPaginationFragment: usePrefetchableForwardPaginationFragment, | ||
useRelayEnvironment: useRelayEnvironment, | ||
@@ -63,0 +65,0 @@ useSubscribeToInvalidationState: useSubscribeToInvalidationState, |
@@ -196,3 +196,3 @@ 'use strict'; | ||
var fragmentSelector = getSelector(fragmentNode, fragmentRef); | ||
!(fragmentSelector != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Relay: Expected to receive an object where `...%s` was spread, ' + 'but the fragment reference was not found`. This is most ' + 'likely the result of:\n' + "- Forgetting to spread `%s` in `%s`'s parent's fragment.\n" + '- Conditionally fetching `%s` but unconditionally passing %s prop ' + 'to `%s`. If the parent fragment only fetches the fragment conditionally ' + '- with e.g. `@include`, `@skip`, or inside a `... on SomeType { }` ' + 'spread - then the fragment reference will not exist. ' + 'In this case, pass `null` if the conditions for evaluating the ' + 'fragment are not met (e.g. if the `@include(if)` value is false.)', fragmentNode.name, fragmentNode.name, componentDisplayName, fragmentNode.name, fragmentKey == null ? 'a fragment reference' : "the `".concat(fragmentKey, "`"), componentDisplayName) : invariant(false) : void 0; | ||
!(fragmentSelector != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Relay: Expected to receive an object where `...%s` was spread, ' + 'but the fragment reference was not found`. This is most ' + 'likely the result of:\n' + "- Forgetting to spread `%s` in `%s`'s parent's fragment.\n" + '- Conditionally fetching `%s` but unconditionally passing %s prop ' + 'to `%s`. If the parent fragment only fetches the fragment conditionally ' + '- with e.g. `@include`, `@skip`, or inside a `... on SomeType { }` ' + 'spread - then the fragment reference will not exist. ' + 'This issue can generally be fixed by adding `@alias` after `...%s`.\n' + 'See https://relay.dev/docs/next/guides/alias-directive/', fragmentNode.name, fragmentNode.name, componentDisplayName, fragmentNode.name, fragmentKey == null ? 'a fragment reference' : "the `".concat(fragmentKey, "`"), componentDisplayName, fragmentNode.name) : invariant(false) : void 0; | ||
var fragmentResult = null; | ||
@@ -247,4 +247,3 @@ var snapshot = null; | ||
var parentQueryPromiseResultPromise = parentQueryPromiseResult === null || parentQueryPromiseResult === void 0 ? void 0 : parentQueryPromiseResult.promise; | ||
var missingResolverFieldPromises = (_missingLiveResolverF2 = (_missingLiveResolverF3 = missingLiveResolverFields(snapshot)) === null || _missingLiveResolverF3 === void 0 ? void 0 : _missingLiveResolverF3.map(function (_ref2) { | ||
var liveStateID = _ref2.liveStateID; | ||
var missingResolverFieldPromises = (_missingLiveResolverF2 = (_missingLiveResolverF3 = missingLiveResolverFields(snapshot)) === null || _missingLiveResolverF3 === void 0 ? void 0 : _missingLiveResolverF3.map(function (liveStateID) { | ||
var store = environment.getStore(); | ||
@@ -314,6 +313,6 @@ return store.getLiveResolverPromise(liveStateID); | ||
snapshot.forEach(function (s) { | ||
handlePotentialSnapshotErrors(_this4._environment, s.errorResponseFields); | ||
handlePotentialSnapshotErrors(_this4._environment, s.fieldErrors); | ||
}); | ||
} else { | ||
handlePotentialSnapshotErrors(this._environment, snapshot.errorResponseFields); | ||
handlePotentialSnapshotErrors(this._environment, snapshot.fieldErrors); | ||
} | ||
@@ -460,3 +459,3 @@ }; | ||
selector: currentSnapshot.selector, | ||
errorResponseFields: currentSnapshot.errorResponseFields | ||
fieldErrors: currentSnapshot.fieldErrors | ||
}; | ||
@@ -463,0 +462,0 @@ if (updatedData !== renderData) { |
@@ -237,3 +237,3 @@ 'use strict'; | ||
checkSameIDAfterRefetch: function checkSameIDAfterRefetch(previousIDAndTypename, refetchedFragmentRef, fragmentNode, componentDisplayName) { | ||
if (previousIDAndTypename == null) { | ||
if (previousIDAndTypename == null || refetchedFragmentRef == null) { | ||
return; | ||
@@ -240,0 +240,0 @@ } |
@@ -27,2 +27,5 @@ 'use strict'; | ||
variables = query.variables; | ||
if ((options === null || options === void 0 ? void 0 : options.includeIf) === false) { | ||
return; | ||
} | ||
var environment = environmentProvider.getEnvironment(environmentProviderOptions); | ||
@@ -29,0 +32,0 @@ preloadedQueries[queryPropName] = loadQuery(environment, parameters, variables, { |
@@ -10,3 +10,2 @@ 'use strict'; | ||
PreloadableQueryRegistry = _require.PreloadableQueryRegistry, | ||
RelayFeatureFlags = _require.RelayFeatureFlags, | ||
ReplaySubject = _require.ReplaySubject, | ||
@@ -40,16 +39,10 @@ createOperationDescriptor = _require.createOperationDescriptor, | ||
var didMakeNetworkRequest = false; | ||
var makeNetworkRequest = function makeNetworkRequest(params) { | ||
var makeNetworkRequest = function makeNetworkRequest(params, checkOperation) { | ||
didMakeNetworkRequest = true; | ||
var observable; | ||
var subject = new ReplaySubject(); | ||
if (RelayFeatureFlags.ENABLE_LOAD_QUERY_REQUEST_DEDUPING === true) { | ||
var identifier = 'raw-network-request-' + getRequestIdentifier(params, variables); | ||
observable = fetchQueryDeduped(environment, identifier, function () { | ||
var network = environment.getNetwork(); | ||
return network.execute(params, variables, networkCacheConfig); | ||
}); | ||
} else { | ||
var identifier = 'raw-network-request-' + getRequestIdentifier(params, variables); | ||
var observable = fetchQueryDeduped(environment, identifier, function () { | ||
var network = environment.getNetwork(); | ||
observable = network.execute(params, variables, networkCacheConfig); | ||
} | ||
return network.execute(params, variables, networkCacheConfig, undefined, undefined, undefined, undefined, checkOperation); | ||
}); | ||
var _observable$subscribe = observable.subscribe({ | ||
@@ -79,5 +72,3 @@ error: function error(err) { | ||
var executeDeduped = function executeDeduped(operation, fetchFn) { | ||
if (RelayFeatureFlags.ENABLE_LOAD_QUERY_REQUEST_DEDUPING === true) { | ||
didMakeNetworkRequest = true; | ||
} | ||
didMakeNetworkRequest = true; | ||
var _fetchQueryDeduped$su = fetchQueryDeduped(environment, operation.request.identifier, fetchFn).subscribe({ | ||
@@ -105,3 +96,5 @@ error: function error(err) { | ||
executeDeduped(operation, function () { | ||
var networkObservable = makeNetworkRequest(concreteRequest.params); | ||
var networkObservable = makeNetworkRequest(concreteRequest.params, function () { | ||
return environment.check(operation); | ||
}); | ||
var executeObservable = executeWithNetworkSource(operation, networkObservable); | ||
@@ -108,0 +101,0 @@ return executeObservable; |
@@ -81,3 +81,8 @@ 'use strict'; | ||
var prevQueryEntry = pendingQueries.get(cacheKey); | ||
var availability = fetchPolicy === STORE_OR_NETWORK_DEFAULT && query != null && query != null ? environment.check(createOperationDescriptor(query, variables, networkCacheConfig)) : { | ||
function checkOperation() { | ||
return query != null ? environment.check(createOperationDescriptor(query, variables, networkCacheConfig)) : { | ||
status: 'missing' | ||
}; | ||
} | ||
var availability = fetchPolicy === STORE_OR_NETWORK_DEFAULT ? checkOperation() : { | ||
status: 'missing' | ||
@@ -109,3 +114,3 @@ }; | ||
} else if (prevQueryEntry == null || prevQueryEntry.kind !== 'network') { | ||
var source = network.execute(params, variables, networkCacheConfig, null); | ||
var source = network.execute(params, variables, networkCacheConfig, null, undefined, undefined, undefined, checkOperation); | ||
var subject = new ReplaySubject(); | ||
@@ -112,0 +117,0 @@ nextQueryEntry = { |
@@ -69,3 +69,3 @@ 'use strict'; | ||
if (state.kind === 'singular') { | ||
handlePotentialSnapshotErrors(environment, state.snapshot.errorResponseFields); | ||
handlePotentialSnapshotErrors(environment, state.snapshot.fieldErrors); | ||
} else if (state.kind === 'plural') { | ||
@@ -77,3 +77,3 @@ var _iterator3 = (0, _createForOfIteratorHelper2["default"])(state.snapshots), | ||
var snapshot = _step3.value; | ||
handlePotentialSnapshotErrors(environment, snapshot.errorResponseFields); | ||
handlePotentialSnapshotErrors(environment, snapshot.fieldErrors); | ||
} | ||
@@ -132,6 +132,6 @@ } catch (err) { | ||
} | ||
!(fragmentRef == null || isPlural && Array.isArray(fragmentRef) && fragmentRef.length === 0 || fragmentSelector != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Relay: Expected to receive an object where `...%s` was spread, ' + 'but the fragment reference was not found`. This is most ' + 'likely the result of:\n' + "- Forgetting to spread `%s` in `%s`'s parent's fragment.\n" + '- Conditionally fetching `%s` but unconditionally passing %s prop ' + 'to `%s`. If the parent fragment only fetches the fragment conditionally ' + '- with e.g. `@include`, `@skip`, or inside a `... on SomeType { }` ' + 'spread - then the fragment reference will not exist. ' + 'In this case, pass `null` if the conditions for evaluating the ' + 'fragment are not met (e.g. if the `@include(if)` value is false.)', fragmentNode.name, fragmentNode.name, hookDisplayName, fragmentNode.name, fragmentKey == null ? 'a fragment reference' : "the `".concat(fragmentKey, "`"), hookDisplayName) : invariant(false) : void 0; | ||
!(fragmentRef == null || isPlural && Array.isArray(fragmentRef) && fragmentRef.length === 0 || fragmentSelector != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Relay: Expected to receive an object where `...%s` was spread, ' + 'but the fragment reference was not found`. This is most ' + 'likely the result of:\n' + "- Forgetting to spread `%s` in `%s`'s parent's fragment.\n" + '- Conditionally fetching `%s` but unconditionally passing %s prop ' + 'to `%s`. If the parent fragment only fetches the fragment conditionally ' + '- with e.g. `@include`, `@skip`, or inside a `... on SomeType { }` ' + 'spread - then the fragment reference will not exist. ' + 'This issue can generally be fixed by adding `@alias` after `...%s`.\n' + 'See https://relay.dev/docs/next/guides/alias-directive/', fragmentNode.name, fragmentNode.name, hookDisplayName, fragmentNode.name, fragmentKey == null ? 'a fragment reference' : "the `".concat(fragmentKey, "`"), hookDisplayName, fragmentNode.name) : invariant(false) : void 0; | ||
var state = getFragmentState(environment, fragmentSelector); | ||
var clientEdgeQueries = null; | ||
if (((_fragmentNode$metadat2 = fragmentNode.metadata) === null || _fragmentNode$metadat2 === void 0 ? void 0 : _fragmentNode$metadat2.hasClientEdges) === true) { | ||
if (((_fragmentNode$metadat2 = fragmentNode.metadata) === null || _fragmentNode$metadat2 === void 0 ? void 0 : _fragmentNode$metadat2.hasClientEdges) === true || RelayFeatureFlags.CHECK_ALL_FRAGMENTS_FOR_MISSING_CLIENT_EDGES) { | ||
var missingClientEdges = getMissingClientEdges(state); | ||
@@ -138,0 +138,0 @@ if (missingClientEdges !== null && missingClientEdges !== void 0 && missingClientEdges.length) { |
@@ -10,2 +10,3 @@ 'use strict'; | ||
var useRelayEnvironment = require('./useRelayEnvironment'); | ||
var useRelayLoggingContext = require('./useRelayLoggingContext'); | ||
var invariant = require('invariant'); | ||
@@ -118,5 +119,5 @@ var _require2 = require('react'), | ||
} | ||
function handlePotentialSnapshotErrorsForState(environment, state) { | ||
function handlePotentialSnapshotErrorsForState(environment, state, loggingContext) { | ||
if (state.kind === 'singular') { | ||
handlePotentialSnapshotErrors(environment, state.snapshot.errorResponseFields); | ||
handlePotentialSnapshotErrors(environment, state.snapshot.fieldErrors, loggingContext); | ||
} else if (state.kind === 'plural') { | ||
@@ -128,3 +129,3 @@ var _iterator5 = (0, _createForOfIteratorHelper2["default"])(state.snapshots), | ||
var snapshot = _step5.value; | ||
handlePotentialSnapshotErrors(environment, snapshot.errorResponseFields); | ||
handlePotentialSnapshotErrors(environment, snapshot.fieldErrors, loggingContext); | ||
} | ||
@@ -156,3 +157,3 @@ } catch (err) { | ||
selector: currentSnapshot.selector, | ||
errorResponseFields: currentSnapshot.errorResponseFields | ||
fieldErrors: currentSnapshot.fieldErrors | ||
}; | ||
@@ -178,3 +179,3 @@ return [updatedData !== state.snapshot.data, { | ||
selector: _currentSnapshot.selector, | ||
errorResponseFields: _currentSnapshot.errorResponseFields | ||
fieldErrors: _currentSnapshot.fieldErrors | ||
}; | ||
@@ -315,4 +316,8 @@ if (_updatedData !== snapshot.data) { | ||
} | ||
!(fragmentRef == null || isPlural && Array.isArray(fragmentRef) && fragmentRef.length === 0 || fragmentSelector != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Relay: Expected to receive an object where `...%s` was spread, ' + 'but the fragment reference was not found`. This is most ' + 'likely the result of:\n' + "- Forgetting to spread `%s` in `%s`'s parent's fragment.\n" + '- Conditionally fetching `%s` but unconditionally passing %s prop ' + 'to `%s`. If the parent fragment only fetches the fragment conditionally ' + '- with e.g. `@include`, `@skip`, or inside a `... on SomeType { }` ' + 'spread - then the fragment reference will not exist. ' + 'In this case, pass `null` if the conditions for evaluating the ' + 'fragment are not met (e.g. if the `@include(if)` value is false.)', fragmentNode.name, fragmentNode.name, hookDisplayName, fragmentNode.name, hookDisplayName) : invariant(false) : void 0; | ||
!(fragmentRef == null || isPlural && Array.isArray(fragmentRef) && fragmentRef.length === 0 || fragmentSelector != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Relay: Expected to receive an object where `...%s` was spread, ' + 'but the fragment reference was not found`. This is most ' + 'likely the result of:\n' + "- Forgetting to spread `%s` in `%s`'s parent's fragment.\n" + '- Conditionally fetching `%s` but unconditionally passing %s prop ' + 'to `%s`. If the parent fragment only fetches the fragment conditionally ' + '- with e.g. `@include`, `@skip`, or inside a `... on SomeType { }` ' + 'spread - then the fragment reference will not exist. ' + 'This issue can generally be fixed by adding `@alias` after `...%s`.\n' + 'See https://relay.dev/docs/next/guides/alias-directive/', fragmentNode.name, fragmentNode.name, hookDisplayName, fragmentNode.name, hookDisplayName, fragmentNode.name) : invariant(false) : void 0; | ||
var environment = useRelayEnvironment(); | ||
var loggerContext; | ||
if (RelayFeatureFlags.ENABLE_UI_CONTEXT_ON_RELAY_LOGGER) { | ||
loggerContext = useRelayLoggingContext(); | ||
} | ||
var _useState = useState(function () { | ||
@@ -347,3 +352,3 @@ return getFragmentState(environment, fragmentSelector); | ||
}, [fragmentSelector]); | ||
if (((_fragmentNode$metadat2 = fragmentNode.metadata) === null || _fragmentNode$metadat2 === void 0 ? void 0 : _fragmentNode$metadat2.hasClientEdges) === true) { | ||
if (((_fragmentNode$metadat2 = fragmentNode.metadata) === null || _fragmentNode$metadat2 === void 0 ? void 0 : _fragmentNode$metadat2.hasClientEdges) === true || RelayFeatureFlags.CHECK_ALL_FRAGMENTS_FOR_MISSING_CLIENT_EDGES) { | ||
var _useMemo = useMemo(function () { | ||
@@ -409,4 +414,3 @@ var missingClientEdges = getMissingClientEdges(state); | ||
if (suspendingLiveResolvers != null && suspendingLiveResolvers.length > 0) { | ||
throw Promise.all(suspendingLiveResolvers.map(function (_ref) { | ||
var liveStateID = _ref.liveStateID; | ||
throw Promise.all(suspendingLiveResolvers.map(function (liveStateID) { | ||
return environment.getStore().getLiveResolverPromise(liveStateID); | ||
@@ -424,3 +428,3 @@ })); | ||
} | ||
handlePotentialSnapshotErrorsForState(environment, state); | ||
handlePotentialSnapshotErrorsForState(environment, state, loggerContext); | ||
var hasPendingStateChanges = useRef(false); | ||
@@ -427,0 +431,0 @@ useEffect(function () { |
@@ -10,2 +10,3 @@ 'use strict'; | ||
var useRelayEnvironment = require('./useRelayEnvironment'); | ||
var useRelayLoggingContext = require('./useRelayLoggingContext'); | ||
var invariant = require('invariant'); | ||
@@ -118,5 +119,5 @@ var _require2 = require('react'), | ||
} | ||
function handlePotentialSnapshotErrorsForState(environment, state) { | ||
function handlePotentialSnapshotErrorsForState(environment, state, loggingContext) { | ||
if (state.kind === 'singular') { | ||
handlePotentialSnapshotErrors(environment, state.snapshot.errorResponseFields); | ||
handlePotentialSnapshotErrors(environment, state.snapshot.fieldErrors, loggingContext); | ||
} else if (state.kind === 'plural') { | ||
@@ -128,3 +129,3 @@ var _iterator5 = (0, _createForOfIteratorHelper2["default"])(state.snapshots), | ||
var snapshot = _step5.value; | ||
handlePotentialSnapshotErrors(environment, snapshot.errorResponseFields); | ||
handlePotentialSnapshotErrors(environment, snapshot.fieldErrors, loggingContext); | ||
} | ||
@@ -156,3 +157,3 @@ } catch (err) { | ||
selector: currentSnapshot.selector, | ||
errorResponseFields: currentSnapshot.errorResponseFields | ||
fieldErrors: currentSnapshot.fieldErrors | ||
}; | ||
@@ -180,3 +181,3 @@ return [updatedData !== state.snapshot.data, { | ||
selector: _currentSnapshot.selector, | ||
errorResponseFields: _currentSnapshot.errorResponseFields | ||
fieldErrors: _currentSnapshot.fieldErrors | ||
}; | ||
@@ -206,3 +207,7 @@ if (_updatedData !== snapshot.data) { | ||
var queryResult = QueryResource.prepare(queryOperationDescriptor, fetchQueryInternal(environment, queryOperationDescriptor), queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.fetchPolicy); | ||
return [queryResult, getPromiseForActiveRequest(environment, queryOperationDescriptor.request)]; | ||
var promise = getPromiseForActiveRequest(environment, queryOperationDescriptor.request); | ||
if (promise != null && promise.displayName == null) { | ||
promise.displayName = missingClientEdgeRequestInfo.request.params.name; | ||
} | ||
return [queryResult, promise]; | ||
} | ||
@@ -331,4 +336,8 @@ function subscribeToSnapshot(environment, state, setState) { | ||
} | ||
!(fragmentRef == null || isPlural && Array.isArray(fragmentRef) && fragmentRef.length === 0 || fragmentSelector != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Relay: Expected to receive an object where `...%s` was spread, ' + 'but the fragment reference was not found`. This is most ' + 'likely the result of:\n' + "- Forgetting to spread `%s` in `%s`'s parent's fragment.\n" + '- Conditionally fetching `%s` but unconditionally passing %s prop ' + 'to `%s`. If the parent fragment only fetches the fragment conditionally ' + '- with e.g. `@include`, `@skip`, or inside a `... on SomeType { }` ' + 'spread - then the fragment reference will not exist. ' + 'In this case, pass `null` if the conditions for evaluating the ' + 'fragment are not met (e.g. if the `@include(if)` value is false.)', fragmentNode.name, fragmentNode.name, hookDisplayName, fragmentNode.name, hookDisplayName) : invariant(false) : void 0; | ||
!(fragmentRef == null || isPlural && Array.isArray(fragmentRef) && fragmentRef.length === 0 || fragmentSelector != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Relay: Expected to receive an object where `...%s` was spread, ' + 'but the fragment reference was not found`. This is most ' + 'likely the result of:\n' + "- Forgetting to spread `%s` in `%s`'s parent's fragment.\n" + '- Conditionally fetching `%s` but unconditionally passing %s prop ' + 'to `%s`. If the parent fragment only fetches the fragment conditionally ' + '- with e.g. `@include`, `@skip`, or inside a `... on SomeType { }` ' + 'spread - then the fragment reference will not exist. ' + 'This issue can generally be fixed by adding `@alias` after `...%s`.\n' + 'See https://relay.dev/docs/next/guides/alias-directive/', fragmentNode.name, fragmentNode.name, hookDisplayName, fragmentNode.name, hookDisplayName) : invariant(false) : void 0; | ||
var environment = useRelayEnvironment(); | ||
var loggerContext; | ||
if (RelayFeatureFlags.ENABLE_UI_CONTEXT_ON_RELAY_LOGGER) { | ||
loggerContext = useRelayLoggingContext(); | ||
} | ||
var _useState = useState(function () { | ||
@@ -350,3 +359,3 @@ return getFragmentState(environment, fragmentSelector); | ||
}, [fragmentSelector]); | ||
if (((_fragmentNode$metadat2 = fragmentNode.metadata) === null || _fragmentNode$metadat2 === void 0 ? void 0 : _fragmentNode$metadat2.hasClientEdges) === true) { | ||
if (((_fragmentNode$metadat2 = fragmentNode.metadata) === null || _fragmentNode$metadat2 === void 0 ? void 0 : _fragmentNode$metadat2.hasClientEdges) === true || RelayFeatureFlags.CHECK_ALL_FRAGMENTS_FOR_MISSING_CLIENT_EDGES) { | ||
var _useMemo = useMemo(function () { | ||
@@ -382,3 +391,7 @@ var missingClientEdges = getMissingClientEdges(state); | ||
if (activeRequestPromises.length) { | ||
throw Promise.all(activeRequestPromises); | ||
var allPromises = Promise.all(activeRequestPromises); | ||
allPromises.displayName = "RelayClientEdge(".concat(activeRequestPromises.map(function (promise) { | ||
return promise.displayName; | ||
}).join(','), ")"); | ||
throw allPromises; | ||
} | ||
@@ -413,6 +426,7 @@ useEffect(function () { | ||
if (suspendingLiveResolvers != null && suspendingLiveResolvers.length > 0) { | ||
throw Promise.all(suspendingLiveResolvers.map(function (_ref) { | ||
var liveStateID = _ref.liveStateID; | ||
var promise = Promise.all(suspendingLiveResolvers.map(function (liveStateID) { | ||
return environment.getStore().getLiveResolverPromise(liveStateID); | ||
})); | ||
promise.displayName = 'RelayLiveResolver(' + fragmentNode.name + ')'; | ||
throw promise; | ||
} | ||
@@ -428,3 +442,3 @@ if (RelayFeatureFlags.ENABLE_RELAY_OPERATION_TRACKER_SUSPENSE || environment !== previousEnvironment || !committedFragmentSelectorRef.current || !areEqualSelectors(committedFragmentSelectorRef.current, fragmentSelector)) { | ||
} | ||
handlePotentialSnapshotErrorsForState(environment, state); | ||
handlePotentialSnapshotErrorsForState(environment, state, loggerContext); | ||
var storeSubscriptionRef = useRef(null); | ||
@@ -431,0 +445,0 @@ useEffect(function () { |
@@ -65,2 +65,3 @@ 'use strict'; | ||
hasMore = _getConnectionState.hasMore; | ||
var isRequestInvalid = fragmentData == null || isParentQueryActive; | ||
var isMountedRef = useIsMountedRef(); | ||
@@ -76,3 +77,3 @@ var loadMore = useCallback(function (count, options) { | ||
var fragmentSelector = getSelector(fragmentNode, fragmentRef); | ||
if (fetchStatusRef.current.kind === 'fetching' || fragmentData == null || isParentQueryActive) { | ||
if (fetchStatusRef.current.kind === 'fetching' || isRequestInvalid) { | ||
if (fragmentSelector == null) { | ||
@@ -129,5 +130,5 @@ process.env.NODE_ENV !== "production" ? warning(false, 'Relay: Unexpected fetch while using a null fragment ref ' + 'for fragment `%s` in `%s`. When fetching more items, we expect ' + "initial fragment data to be non-null. Please make sure you're " + 'passing a valid fragment ref to `%s` before paginating.', fragmentNode.name, componentDisplayName, componentDisplayName) : void 0; | ||
}; | ||
}, [environment, identifierValue, direction, cursor, isParentQueryActive, fragmentData, fragmentNode.name, fragmentRef, componentDisplayName]); | ||
}, [environment, identifierValue, direction, cursor, isRequestInvalid, fragmentNode.name, fragmentRef, componentDisplayName]); | ||
return [loadMore, hasMore, forceDisposeFn]; | ||
} | ||
module.exports = useLoadMoreFunction_EXPERIMENTAL; |
@@ -74,2 +74,3 @@ 'use strict'; | ||
}, [disposeFetch]); | ||
var isRequestInvalid = fragmentData == null || isParentQueryActive; | ||
var loadMore = useCallback(function (count, options) { | ||
@@ -84,3 +85,3 @@ var onComplete = options === null || options === void 0 ? void 0 : options.onComplete; | ||
var fragmentSelector = getSelector(fragmentNode, fragmentRef); | ||
if (isFetchingRef.current === true || fragmentData == null || isParentQueryActive) { | ||
if (isFetchingRef.current === true || isRequestInvalid) { | ||
if (fragmentSelector == null) { | ||
@@ -130,5 +131,5 @@ process.env.NODE_ENV !== "production" ? warning(false, 'Relay: Unexpected fetch while using a null fragment ref ' + 'for fragment `%s` in `%s`. When fetching more items, we expect ' + "initial fragment data to be non-null. Please make sure you're " + 'passing a valid fragment ref to `%s` before paginating.', fragmentNode.name, componentDisplayName, componentDisplayName) : void 0; | ||
}; | ||
}, [environment, identifierValue, direction, cursor, startFetch, disposeFetch, completeFetch, isFetchingRef, isParentQueryActive, fragmentData, fragmentNode.name, fragmentRef, componentDisplayName]); | ||
}, [environment, identifierValue, direction, cursor, startFetch, disposeFetch, completeFetch, isFetchingRef, isRequestInvalid, fragmentNode.name, fragmentRef, componentDisplayName]); | ||
return [loadMore, hasMore, disposeFetch]; | ||
} | ||
module.exports = useLoadMoreFunction; |
@@ -14,2 +14,3 @@ 'use strict'; | ||
var _require2 = require('relay-runtime'), | ||
RelayFeatureFlags = _require2.RelayFeatureFlags, | ||
getFragment = _require2.getFragment, | ||
@@ -114,3 +115,6 @@ getFragmentIdentifier = _require2.getFragmentIdentifier, | ||
return setIsLoadingMore(false); | ||
} | ||
}, | ||
unsubscribe: RelayFeatureFlags.ENABLE_USE_PAGINATION_IS_LOADING_FIX ? function () { | ||
return setIsLoadingMore(false); | ||
} : undefined | ||
}; | ||
@@ -117,0 +121,0 @@ var handleReset = function handleReset() { |
@@ -58,3 +58,3 @@ 'use strict'; | ||
} | ||
function useRefetchableFragmentNode(fragmentNode, parentFragmentRef, componentDisplayName) { | ||
function useRefetchableFragmentInternal(fragmentNode, parentFragmentRef, componentDisplayName) { | ||
var parentEnvironment = useRelayEnvironment(); | ||
@@ -230,3 +230,3 @@ var _getRefetchMetadata = getRefetchMetadata(fragmentNode, componentDisplayName), | ||
checkSameIDAfterRefetch: function checkSameIDAfterRefetch(previousIDAndTypename, refetchedFragmentRef, fragmentNode, componentDisplayName) { | ||
if (previousIDAndTypename == null) { | ||
if (previousIDAndTypename == null || refetchedFragmentRef == null) { | ||
return; | ||
@@ -243,2 +243,2 @@ } | ||
} | ||
module.exports = useRefetchableFragmentNode; | ||
module.exports = useRefetchableFragmentInternal; |
{ | ||
"name": "react-relay", | ||
"description": "A framework for building GraphQL-driven React applications.", | ||
"version": "0.0.0-main-ad262841", | ||
"version": "0.0.0-main-ad4b15c9", | ||
"keywords": [ | ||
@@ -23,6 +23,6 @@ "graphql", | ||
"nullthrows": "^1.1.1", | ||
"relay-runtime": "0.0.0-main-ad262841" | ||
"relay-runtime": "0.0.0-main-ad4b15c9" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.9.0 || ^17 || ^18" | ||
"react": "^16.9.0 || ^17 || ^18 || ^19" | ||
}, | ||
@@ -29,0 +29,0 @@ "directories": { |
/** | ||
* Relay v0.0.0-main-ad262841 | ||
* Relay v0.0.0-main-ad4b15c9 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Meta Platforms, Inc. and affiliates. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
193
1.05%7404
6.56%1
-85.71%909020
-23.31%127
7.63%+ Added
+ Added
- Removed
- Removed