Skip to content

Commit 9e5216b

Browse files
committed
docs: add cleanup doc
1 parent 4f1f2ad commit 9e5216b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ const {
7575
getErrorMessage,
7676
errorPaths,
7777
focusFirstErroredInput,
78+
cleanup,
7879
} = useFormValidation(schema, form)
7980

8081
// Submit your form
@@ -110,6 +111,7 @@ const { validate } = useFormValidation(schema, form, options)
110111
- errorPaths: Computed property that returns an array of all error paths, including nested ones (e.g., ["email", "user.name"]).
111112
- focusFirstErroredInput(): Focuses the first input with an error.
112113
- focusInput(inputName: keyof F | string): Focuses a specific input by its name. Supports nested paths like "user.name".
114+
- cleanup(): Manually cleans up watchers, event listeners, and caches. Automatically called on component unmount when used inside a component context.
113115

114116
## API Reference
115117

@@ -148,6 +150,7 @@ Returns an object containing the following properties:
148150
- `errorPaths`: Computed property that returns an array of all error paths, including nested ones (e.g., ["email", "user.name"]).
149151
- `focusFirstErroredInput`: Function to focus the first input with an error.
150152
- `focusInput`: Function to focus a specific input. Supports nested paths like "user.name".
153+
- `cleanup`: Function to manually clean up watchers, event listeners, and caches. This is automatically called when the component unmounts if used within a component context, but can be called manually when needed (e.g., when using the composable outside of a component or for manual cleanup).
151154

152155
## Deep Strategy Example
153156

0 commit comments

Comments
 (0)