Skip to content

Commit

Permalink
Fix: handle null cases in callback functions (#37)
Browse files Browse the repository at this point in the history
* Fix: handle null cases in callback functions

* updated version to next
  • Loading branch information
NielsJPeschel authored Oct 22, 2024
1 parent 1288cb5 commit ab5acc4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion hooks/useLoadData/callbacks/complete/complete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export function complete<T>(onSuccess?: (data: T) => void, onError?: (error: unk
return (err?: unknown, res?: T) => {
if (err) {
onError?.(err);
} else if (res) {
} else if (res || res === null) {
onSuccess?.(res);
}
};
Expand Down
2 changes: 1 addition & 1 deletion hooks/useLoadData/callbacks/success/success.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export function success<T>(onSuccess?: (data: T) => void) {
return (err?: unknown, res?: T) => {
if (res) {
if (res || res === null) {
onSuccess?.(res);
}
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@optum/react-hooks",
"version": "1.0.3",
"version": "1.0.3-next.1",
"description": "A reusable set of React hooks",
"repository": "https://github.com/Optum/react-hooks",
"license": "Apache 2.0",
Expand Down

0 comments on commit ab5acc4

Please sign in to comment.