Skip to content

Commit 3a97dae

Browse files
Update useUpdateWithSetter.ts (#131)
1 parent 5938cb2 commit 3a97dae

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/utils/useUpdateWithSetter.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ export const useUpdateWithSetter = <
2828
): void => {
2929
React.useEffect(() => {
3030
if (!component) return;
31-
onUpdated(component, value);
31+
32+
try {
33+
onUpdated(component, value);
34+
} catch (error) {
35+
console.error('Error when calling setter! ', error);
36+
return;
37+
}
3238
}, [component, value, onUpdated]);
3339
};

0 commit comments

Comments
 (0)