react-relay
Version:
A framework for building GraphQL-driven React applications.
46 lines (40 loc) • 1.27 kB
Flow
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
* @oncall relay
*/
;
import type {FragmentQueryOptions} from './useFragmentInternal_EXPERIMENTAL';
import type {ReaderFragment, SelectorData} from 'relay-runtime';
import useFragmentInternal_CURRENT from './useFragmentInternal_CURRENT';
import useFragmentInternal_EXPERIMENTAL from './useFragmentInternal_EXPERIMENTAL';
import {RelayFeatureFlags} from 'relay-runtime';
hook useFragmentInternal(
fragmentNode: ReaderFragment,
fragmentRef: mixed,
hookDisplayName: string,
queryOptions?: FragmentQueryOptions,
): ?SelectorData | Array<?SelectorData> {
if (RelayFeatureFlags.ENABLE_ACTIVITY_COMPATIBILITY) {
// $FlowFixMe[react-rule-hook] - the condition is static
return useFragmentInternal_EXPERIMENTAL(
fragmentNode,
fragmentRef,
hookDisplayName,
queryOptions,
);
}
// $FlowFixMe[react-rule-hook] - the condition is static
return useFragmentInternal_CURRENT(
fragmentNode,
fragmentRef,
hookDisplayName,
queryOptions,
);
}
module.exports = useFragmentInternal;