Skip to content

Commit

Permalink
enable by default recreating loadMore optimization
Browse files Browse the repository at this point in the history
Reviewed By: tyao1

Differential Revision: D69861341

fbshipit-source-id: 1f55c614a0fc97f576d5a39b88983db6b1d89694
  • Loading branch information
Tom910 authored and facebook-github-bot committed Feb 20, 2025
1 parent 8c32ec4 commit a6f66eb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 24 deletions.
10 changes: 1 addition & 9 deletions packages/react-relay/relay-hooks/useLoadMoreFunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,7 @@ hook useLoadMoreFunction_CURRENT<TVariables: Variables>(

const fragmentSelector = getSelector(fragmentNode, fragmentRef);

const isRequestInvalidCheck =
RelayFeatureFlags.OPTIMIZE_RECREATING_LOAD_MORE_FUNCTION
? isRequestInvalid
: fragmentData == null || isParentQueryActive;

if (isFetchingRef.current === true || isRequestInvalidCheck) {
if (isFetchingRef.current === true || isRequestInvalid) {
if (fragmentSelector == null) {
warning(
false,
Expand Down Expand Up @@ -276,9 +271,6 @@ hook useLoadMoreFunction_CURRENT<TVariables: Variables>(
completeFetch,
isFetchingRef,
isRequestInvalid,
...(RelayFeatureFlags.OPTIMIZE_RECREATING_LOAD_MORE_FUNCTION
? [isRequestInvalid]
: [isParentQueryActive, fragmentData]),
fragmentNode.name,
fragmentRef,
componentDisplayName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const invariant = require('invariant');
const {useCallback, useRef, useState} = require('react');
const {
__internal: {fetchQuery},
RelayFeatureFlags,
createOperationDescriptor,
getPaginationVariables,
getRefetchMetadata,
Expand Down Expand Up @@ -168,12 +167,7 @@ hook useLoadMoreFunction_EXPERIMENTAL<TVariables: Variables>(

const fragmentSelector = getSelector(fragmentNode, fragmentRef);

const isRequestInvalidCheck =
RelayFeatureFlags.OPTIMIZE_RECREATING_LOAD_MORE_FUNCTION
? isRequestInvalid
: fragmentData == null || isParentQueryActive;

if (fetchStatusRef.current.kind === 'fetching' || isRequestInvalidCheck) {
if (fetchStatusRef.current.kind === 'fetching' || isRequestInvalid) {
if (fragmentSelector == null) {
warning(
false,
Expand Down Expand Up @@ -272,9 +266,7 @@ hook useLoadMoreFunction_EXPERIMENTAL<TVariables: Variables>(
identifierValue,
direction,
cursor,
...(RelayFeatureFlags.OPTIMIZE_RECREATING_LOAD_MORE_FUNCTION
? [isRequestInvalid]
: [isParentQueryActive, fragmentData]),
isRequestInvalid,
fragmentNode.name,
fragmentRef,
componentDisplayName,
Expand Down
5 changes: 0 additions & 5 deletions packages/relay-runtime/util/RelayFeatureFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ export type FeatureFlags = {
// Temporary flag to experiment to enable compatibility with React's unstable <Activity> API
ENABLE_ACTIVITY_COMPATIBILITY: boolean,

// Enables optimization for recreating the load more function.
// When enabled, this flag reduce and simplify amount of dependencies for the function loadMore
OPTIMIZE_RECREATING_LOAD_MORE_FUNCTION: boolean,

// Adds a prefix to the storage key of read time resolvers. This is used to
// disambiguate the same resolver being used at both read time and exec time.
ENABLE_READ_TIME_RESOLVER_STORAGE_KEY_PREFIX: boolean,
Expand Down Expand Up @@ -90,7 +86,6 @@ const RelayFeatureFlags: FeatureFlags = {
ENABLE_RELAY_OPERATION_TRACKER_SUSPENSE: false,
PROCESS_OPTIMISTIC_UPDATE_BEFORE_SUBSCRIPTION: false,
MARK_RESOLVER_VALUES_AS_CLEAN_AFTER_FRAGMENT_REREAD: false,
OPTIMIZE_RECREATING_LOAD_MORE_FUNCTION: false,
ENABLE_CYLE_DETECTION_IN_VARIABLES: false,
ENABLE_ACTIVITY_COMPATIBILITY: false,
ENABLE_READ_TIME_RESOLVER_STORAGE_KEY_PREFIX: true,
Expand Down

0 comments on commit a6f66eb

Please sign in to comment.