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.
@@ -1,5 +1,5 @@
1
1
 
2
- > server-act@0.0.9 build /home/runner/work/server-act/server-act/packages/server-act
2
+ > server-act@0.0.10 build /home/runner/work/server-act/server-act/packages/server-act
3
3
  > tsup
4
4
 
5
5
  CLI Building entry: ./src/index.ts
@@ -17,6 +17,6 @@
17
17
  CJS dist/index.js.map 11.92 KB
18
18
  CJS ⚡️ Build success in 42ms
19
19
  DTS Build start
20
- DTS ⚡️ Build success in 1097ms
20
+ DTS ⚡️ Build success in 1059ms
21
21
  DTS dist/index.d.mts 2.12 KB
22
22
  DTS dist/index.d.ts 2.12 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # server-act
2
2
 
3
+ ## 0.0.10
4
+
5
+ ### Patch Changes
6
+
7
+ - a2ab457: Fixed form action doc
8
+
3
9
  ## 0.0.9
4
10
 
5
11
  ### Patch Changes
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?.formErrors?.name?.map((error) => <p key={error}>{error}</p>)}
122
+ {state.formErrors?.name?.map((error) => <p key={error}>{error}</p>)}
129
123
 
130
124
  <button type="submit">Submit</button>
131
125
 
132
- {!!state?.success && <p>{state.message}</p>}
126
+ {!!state.message && <p>{state.message}</p>}
133
127
  </form>
134
128
  );
135
129
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "server-act",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "homepage": "https://github.com/chungweileong94/server-act#readme",
5
5
  "repository": {
6
6
  "type": "git",