diff --git a/packages/react-core/src/remote-hook-provider.tsx b/packages/react-core/src/remote-hook-provider.tsx index e92ff96..e4712d6 100644 --- a/packages/react-core/src/remote-hook-provider.tsx +++ b/packages/react-core/src/remote-hook-provider.tsx @@ -50,7 +50,8 @@ function HookExecutor({ // Update state with the result useEffect(() => { - updateState(id, { hookResult }); + // always set loading to false when we have a result + updateState(id, { loading: false, hookResult }); }, [hookResult, id, updateState]); return null; diff --git a/packages/react-core/src/use-remote-hook.ts b/packages/react-core/src/use-remote-hook.ts index eb6aa93..4b83bbb 100644 --- a/packages/react-core/src/use-remote-hook.ts +++ b/packages/react-core/src/use-remote-hook.ts @@ -32,7 +32,6 @@ export const useRemoteHook = ({ // Only update if component is still mounted if (isMounted) { - updateState(id, { loading: false, error: null }); updateArgs(id, args); // Set args before registering hook registerHook(id, hookFunction); }