-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from IdoPesok/undefined-data-bug
handle undefined data properly, fixes #138
- Loading branch information
Showing
7 changed files
with
83 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"zsa-react": patch | ||
--- | ||
|
||
Fix isSuccess with undefined data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,6 @@ jobs: | |
|
||
- name: Test | ||
run: npm run test | ||
|
||
- name: Typecheck | ||
run: npm run typecheck |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
tests/jest/app/tests/client/undefined-success-action/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"use client" | ||
|
||
import { undefinedSuccessAction } from "server/actions" | ||
import { CLIENT_TEST_DATA } from "server/data" | ||
import { useServerAction } from "zsa-react" | ||
|
||
export default function UndefinedSuccessActionUI() { | ||
const { isPending, execute, isSuccess } = useServerAction( | ||
undefinedSuccessAction | ||
) | ||
|
||
return ( | ||
<div> | ||
<button | ||
role="invoke" | ||
onClick={async () => { | ||
await execute({ ms: CLIENT_TEST_DATA.sleep }) | ||
}} | ||
> | ||
Invoke action | ||
</button> | ||
<div role="result"> | ||
{isPending | ||
? CLIENT_TEST_DATA.loadingMessage | ||
: JSON.stringify(isSuccess)} | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters