react-relay
Version:
A framework for building GraphQL-driven React applications.
35 lines (29 loc) • 959 B
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 {FragmentType, GraphQLTaggedNode} from 'relay-runtime';
const useIsOperationNodeActive = require('./useIsOperationNodeActive');
const useStaticFragmentNodeWarning = require('./useStaticFragmentNodeWarning');
const {getFragment} = require('relay-runtime');
hook useIsParentQueryActive<
TKey: ?{+$data?: mixed, +$fragmentSpreads: FragmentType, ...},
>(
fragmentInput: GraphQLTaggedNode,
fragmentRef: TKey,
): boolean {
const fragmentNode = getFragment(fragmentInput);
useStaticFragmentNodeWarning(
fragmentNode,
'first argument of useIsParentQueryActive()',
);
return useIsOperationNodeActive(fragmentNode, fragmentRef);
}
module.exports = useIsParentQueryActive;