server-act 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +2 -2
- package/CHANGELOG.md +6 -0
- package/README.md +5 -11
- package/package.json +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> server-act@0.0.
|
|
2
|
+
> server-act@0.0.10 build /home/runner/work/server-act/server-act/packages/server-act
|
|
3
3
|
> tsup
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: ./src/index.ts
|
|
@@ -17,6 +17,6 @@
|
|
|
17
17
|
[32mCJS[39m [1mdist/index.js.map [22m[32m11.92 KB[39m
|
|
18
18
|
[32mCJS[39m ⚡️ Build success in 42ms
|
|
19
19
|
[34mDTS[39m Build start
|
|
20
|
-
[32mDTS[39m ⚡️ Build success in
|
|
20
|
+
[32mDTS[39m ⚡️ Build success in 1059ms
|
|
21
21
|
[32mDTS[39m [1mdist/index.d.mts [22m[32m2.12 KB[39m
|
|
22
22
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m2.12 KB[39m
|
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -101,15 +101,9 @@ export const sayHelloAction = serverAct
|
|
|
101
101
|
)
|
|
102
102
|
.experimental_formAction(async ({ input, formErrors, ctx }) => {
|
|
103
103
|
if (formErrors) {
|
|
104
|
-
return {
|
|
105
|
-
success: false as const,
|
|
106
|
-
formErrors: formErrors.formErrors.fieldErrors,
|
|
107
|
-
};
|
|
104
|
+
return { formErrors: formErrors.formErrors.fieldErrors };
|
|
108
105
|
}
|
|
109
|
-
return {
|
|
110
|
-
success: true as const,
|
|
111
|
-
message: `Hello, ${input.name}!`,
|
|
112
|
-
};
|
|
106
|
+
return { message: `Hello, ${input.name}!` };
|
|
113
107
|
});
|
|
114
108
|
```
|
|
115
109
|
|
|
@@ -120,16 +114,16 @@ export const sayHelloAction = serverAct
|
|
|
120
114
|
import { sayHelloAction } from "./action";
|
|
121
115
|
|
|
122
116
|
export const ClientComponent = () => {
|
|
123
|
-
const [state, dispatch] = useFormState(sayHelloAction);
|
|
117
|
+
const [state, dispatch] = useFormState(sayHelloAction, { formErrors: {} });
|
|
124
118
|
|
|
125
119
|
return (
|
|
126
120
|
<form action={dispatch}>
|
|
127
121
|
<input name="name" required />
|
|
128
|
-
{state
|
|
122
|
+
{state.formErrors?.name?.map((error) => <p key={error}>{error}</p>)}
|
|
129
123
|
|
|
130
124
|
<button type="submit">Submit</button>
|
|
131
125
|
|
|
132
|
-
{!!state
|
|
126
|
+
{!!state.message && <p>{state.message}</p>}
|
|
133
127
|
</form>
|
|
134
128
|
);
|
|
135
129
|
};
|