Skip to content

Commit

Permalink
[react-relay]: Export ProfilerContext
Browse files Browse the repository at this point in the history
  • Loading branch information
tomgasson committed Sep 27, 2022
1 parent e1b1a23 commit 3dc25b3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions types/react-relay/hooks.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ export { requestSubscription } from 'relay-runtime';
export { RelayEnvironmentProvider } from './relay-hooks/RelayEnvironmentProvider.react';
export { EntryPointContainer } from './relay-hooks/EntryPointContainer.react';

export { ProfilerContext } from './relay-hooks/ProfilerContext';

export { fetchQuery } from 'relay-runtime';

export { loadQuery } from './relay-hooks/loadQuery';
Expand Down
15 changes: 15 additions & 0 deletions types/react-relay/test/react-relay-tests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
RelayProp,
RelayRefetchProp,
requestSubscription,
ProfilerContext,
} from 'react-relay';

// ~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -759,3 +760,17 @@ const MyRelayContextConsumer: React.FunctionComponent = () => {
/>
);
};

const MyRelayProfilerContextProvider: React.FunctionComponent = () => {
const context = React.useMemo(
() => ({
wrapPrepareQueryResource<T>(cb: () => T): T {
return cb();
},
}),
[],
);
return (
<ProfilerContext.Provider value={context}><div /></ProfilerContext.Provider>
);
};

0 comments on commit 3dc25b3

Please sign in to comment.