Skip to content

Commit

Permalink
docs: update requirements and references to stable version
Browse files Browse the repository at this point in the history
  • Loading branch information
TheEdoRan committed Jun 11, 2024
1 parent 5a05a40 commit c52ba36
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 15 deletions.
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div align="center">
<img src="assets/logo.png" alt="next-safe-action logo" width="36" height="36">
<img src="https://raw.githubusercontent.com/TheEdoRan/next-safe-action/main/assets/logo.png" alt="next-safe-action logo" width="36" height="36">
<a href="https://github.com/TheEdoRan/next-safe-action"><h1>next-safe-action</h1></a>
</div>

Expand All @@ -23,21 +23,29 @@ https://github.com/TheEdoRan/next-safe-action/assets/1337629/664eb3ee-92f3-4d4a-

## Documentation

**Explore the documentation for the next version of the library on the [next-safe-action website](https://next.next-safe-action.dev).**
**Explore the documentation for the current stable version of the library on the [next-safe-action v7 website](https://next-safe-action.dev).**

### Looking for v6 docs?

You can keep using version 6 and eventually upgrade to version 7. Check out the v6 documentation [here](https://v6.next-safe-action.dev).

## Migrate from v6 to v7

Check out the [v6 to v7 migration guide](https://next-safe-action.dev/docs/migrations/v6-to-v7) to learn how to update your code for v7.

## Installation

```bash
npm i next-safe-action@next
npm i next-safe-action
```

## Playground

You can find a basic working implementation of the library [here](apps/playground).
You can find a basic working implementation of the library [here](https://github.com/TheEdoRan/next-safe-action/tree/main/apps/playground).

## Contributing

If you want to contribute to next-safe-action, please check out the [contributing guide](CONTRIBUTING.md).
If you want to contribute to next-safe-action, please check out the [contributing guide](https://github.com/TheEdoRan/next-safe-action/blob/main/CONTRIBUTING.md).

If you found bugs or just want to ask a question, feel free to open an issue or a discussion by following the [issue templates](https://github.com/TheEdoRan/next-safe-action/issues/new/choose).

Expand All @@ -51,4 +59,4 @@ Made with [contrib.rocks](https://contrib.rocks).

## License

next-safe-action is released under the [MIT License](./LICENSE).
next-safe-action is released under the [MIT License](https://github.com/TheEdoRan/next-safe-action/blob/main/LICENSE).
14 changes: 11 additions & 3 deletions packages/next-safe-action/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,20 @@ https://github.com/TheEdoRan/next-safe-action/assets/1337629/664eb3ee-92f3-4d4a-

## Documentation

**Explore the documentation for the next version of the library on the [next-safe-action website](https://next.next-safe-action.dev).**
**Explore the documentation for the current stable version of the library on the [next-safe-action v7 website](https://next-safe-action.dev).**

### Looking for v6 docs?

You can keep using version 6 and eventually upgrade to version 7. Check out the v6 documentation [here](https://v6.next-safe-action.dev).

## Migrate from v6 to v7

Check out the [v6 to v7 migration guide](https://next-safe-action.dev/docs/migrations/v6-to-v7) to learn how to update your code for v7.

## Installation

```bash
npm i next-safe-action@next
npm i next-safe-action
```

## Playground
Expand All @@ -37,7 +45,7 @@ You can find a basic working implementation of the library [here](https://github

## Contributing

If you want to contribute to next-safe-action, please check out the [contributing guide](https://github.com/TheEdoRan/next-safe-action/tree/next/CONTRIBUTING.md).
If you want to contribute to next-safe-action, please check out the [contributing guide](https://github.com/TheEdoRan/next-safe-action/blob/main/CONTRIBUTING.md).

If you found bugs or just want to ask a question, feel free to open an issue or a discussion by following the [issue templates](https://github.com/TheEdoRan/next-safe-action/issues/new/choose).

Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion website/docs/execution/hooks/usestateaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ description: Learn how to use the useStateAction hook.
`useStateAction` keeps track of the previous action execution result(s), thanks to the [`useActionState`](https://react.dev/reference/react/useActionState) hook from React that is used under the hood. This hook works with actions declared with the [`stateAction`](/docs/safe-action-client/instance-methods#action--stateaction) instance method, that changes the function signature, placing a `prevResult` argument in the first position, and an input (if a validation schema was provided) in the second one. When a stateful action is passed to `useStateAction` hook, the returned `execute` function will accept just the (optional) input and returns the action result, as the normal `useAction` hook does.

:::note
React's `useActionState` hook has replaced the previous `useFormState` hook, that is now deprecated. You can explore the documentation for it in the [React docs](https://react.dev/reference/react/useActionState).
React's `useActionState` hook has replaced the previous `useFormState` hook, that is deprecated in React 19. You can explore the documentation for it in the [React docs](https://react.dev/reference/react/useActionState).
:::

:::warning important
This hook requires Next.js >= 15 to work, because previous versions do not support the React's `useActionState` hook that is used under the hood.
:::

Let's say you want to update the number of likes of a post in your application, mutating directly the database.
Expand Down
5 changes: 3 additions & 2 deletions website/docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ description: Getting started with next-safe-action version 7.

:::info Requirements

- Next.js >= 15
- Next.js >= 14 (>= 15 for [`useStateAction`](/docs/execution/hooks/usestateaction) hook)
- React >= 18.2.0
- TypeScript >= 5
- Zod or a validation library supported by [TypeSchema](https://typeschema.com/#coverage)
:::
Expand All @@ -19,7 +20,7 @@ description: Getting started with next-safe-action version 7.
Assuming you want to use Zod as your validation library, use the following command:

```bash npm2yarn
npm i next-safe-action@next zod
npm i next-safe-action zod
```

:::note
Expand Down
2 changes: 1 addition & 1 deletion website/docs/migrations/v6-to-v7.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ TypeSchema was updated to v0.13, so now, if you want to use a validation library

## Requirements

next-safe-action version 7 requires Next.js 15 and React 19 or later to work.
next-safe-action version 7 requires Next.js 14 and React 18.2.0 or later to work. For `useActionState` hook, the minimum required Next.js version is 15, since previous versions don't support the React's `useStateAction` hook that is used under the hood.

## What about v6?

Expand Down
2 changes: 1 addition & 1 deletion website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default {
announcementBar: {
id: "banner_version_7",
content:
"You are viewing documentation for version 7 (beta) of the library. To access current stable version docs, visit the <a href='https://v6.next-safe-action.dev'>v6 website</a>.",
"You are viewing documentation for the current stable version (v7) of the library. To access previous version docs, visit the <a href='https://v6.next-safe-action.dev'>v6 website</a>.",
backgroundColor: "#1f252e",
textColor: "#ffffff",
isCloseable: true,
Expand Down

0 comments on commit c52ba36

Please sign in to comment.