Skip to content

Commit

Permalink
[crud] Only export uRC when flag is enabled
Browse files Browse the repository at this point in the history
It's tricky to do feature detection of uRC currently because it's always present on the export. Let's conditionally export it instead.
  • Loading branch information
poteto committed Nov 22, 2024
1 parent aba370f commit c9444d3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/react/src/ReactHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,16 +229,13 @@ export function useEffectEvent<Args, F: (...Array<Args>) => mixed>(
return dispatcher.useEffectEvent(callback);
}

export function useResourceEffect(
function experimental_useResourceEffect(
create: () => mixed,
createDeps: Array<mixed> | void | null,
update: ((resource: mixed) => void) | void,
updateDeps: Array<mixed> | void | null,
destroy: ((resource: mixed) => void) | void,
): void {
if (!enableUseResourceEffectHook) {
throw new Error('Not implemented.');
}
const dispatcher = resolveDispatcher();
// $FlowFixMe[not-a-function] This is unstable, thus optional
return dispatcher.useResourceEffect(
Expand All @@ -249,6 +246,8 @@ export function useResourceEffect(
destroy,
);
}
export const useResourceEffect: typeof experimental_useResourceEffect | null =
enableUseResourceEffectHook ? experimental_useResourceEffect : null;

export function useOptimistic<S, A>(
passthrough: S,
Expand Down

0 comments on commit c9444d3

Please sign in to comment.