Skip to content

Commit eca3de6

Browse files
authored
Merge pull request #160 from scalprum/remove-hook-result-undefined
fix(react-core): set loading flag on remote hook render
2 parents cd2d622 + fe768bf commit eca3de6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/react-core/src/remote-hook-provider.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ function HookExecutor({
5050

5151
// Update state with the result
5252
useEffect(() => {
53-
updateState(id, { hookResult });
53+
// always set loading to false when we have a result
54+
updateState(id, { loading: false, hookResult });
5455
}, [hookResult, id, updateState]);
5556

5657
return null;

packages/react-core/src/use-remote-hook.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export const useRemoteHook = <T>({
3232

3333
// Only update if component is still mounted
3434
if (isMounted) {
35-
updateState(id, { loading: false, error: null });
3635
updateArgs(id, args); // Set args before registering hook
3736
registerHook(id, hookFunction);
3837
}

0 commit comments

Comments
 (0)