Skip to content

Commit ab5acc4

Browse files
Fix: handle null cases in callback functions (#37)
* Fix: handle null cases in callback functions * updated version to next
1 parent 1288cb5 commit ab5acc4

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

hooks/useLoadData/callbacks/complete/complete.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export function complete<T>(onSuccess?: (data: T) => void, onError?: (error: unk
22
return (err?: unknown, res?: T) => {
33
if (err) {
44
onError?.(err);
5-
} else if (res) {
5+
} else if (res || res === null) {
66
onSuccess?.(res);
77
}
88
};

hooks/useLoadData/callbacks/success/success.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export function success<T>(onSuccess?: (data: T) => void) {
22
return (err?: unknown, res?: T) => {
3-
if (res) {
3+
if (res || res === null) {
44
onSuccess?.(res);
55
}
66
};

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@optum/react-hooks",
3-
"version": "1.0.3",
3+
"version": "1.0.3-next.1",
44
"description": "A reusable set of React hooks",
55
"repository": "https://github.com/Optum/react-hooks",
66
"license": "Apache 2.0",

0 commit comments

Comments
 (0)