Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[crud] Only export uRC when flag is enabled #31617

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3276,6 +3276,11 @@ describe('ReactHooksWithNoopRenderer', () => {
}
}

// @gate !enableUseResourceEffectHook
it('is null when flag is disabled', async () => {
expect(useResourceEffect).toBeUndefined();
});

// @gate enableUseResourceEffectHook
it('validates create return value', async () => {
function App({id}) {
Expand Down
5 changes: 4 additions & 1 deletion packages/react/src/ReactClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import {startTransition} from './ReactStartTransition';
import {act} from './ReactAct';
import {captureOwnerStack} from './ReactOwnerStack';
import ReactCompilerRuntime from './ReactCompilerRuntime';
import {enableUseResourceEffectHook} from 'shared/ReactFeatureFlags';

const Children = {
map,
Expand All @@ -90,7 +91,6 @@ export {
useContext,
useEffect,
useEffectEvent as experimental_useEffectEvent,
useResourceEffect as experimental_useResourceEffect,
useImperativeHandle,
useDebugValue,
useInsertionEffect,
Expand Down Expand Up @@ -131,3 +131,6 @@ export {
act, // DEV-only
captureOwnerStack, // DEV-only
};

export const experimental_useResourceEffect: typeof useResourceEffect | void =
enableUseResourceEffectHook ? useResourceEffect : undefined;
Loading