-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: baseline experimental actions * feat(test): remove experimental config * feat: remove getActionProps() * feat: make actions file non-break * feat: detect actions usage * chore: changeset * feat: improve actions usage check * refactor: remove define action symbol now that we check server exp * fix: remove old import * chore: move actionsIntegration to top import * fix: warn only when actions are used * fix: srcDir check * refactor: split out action plugins to simplify integration * feat: new integration and plugins * chore: update error hints * fix(test): pass default src dir * feat: add ActionNotFoundError * fix: handle json parse errors in deserializer * chore: unused import * 500 -> 404 * New `astro:schema` module (#11810) * feat: expose zod from astro:schema * chore: changeset * chore: update release strategy in changeset * fix: move deprecated notice to type def * fix: update config doc reference * chore: remove z from astro:actions * edit: changeset with minor release note remove * wip: increase button click timeouts * Revert "wip: increase button click timeouts" This reverts commit a870bc2. * chore: remove content collections disclaimer * fix: undo biome change * agh tabs * agh newlines * fix: bad docs merge * wip: add back timeout extension * fix(test): astro schema import * refactor: move static output error to config done * refactor: usesActions -> isActionsFilePresent * fix: check whether startup and current value disagree * chore: unused import * edit: sell actions a little more * changeset nit --------- Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
- Loading branch information
1 parent
8bab233
commit 5b4070e
Showing
29 changed files
with
361 additions
and
418 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,17 @@ | ||
--- | ||
'astro': minor | ||
--- | ||
|
||
Exposes `z` from the new `astro:schema` module. This is the new recommended import source for all Zod utilities when using Astro Actions. | ||
|
||
## Migration for Astro Actions users | ||
|
||
`z` will no longer be exposed from `astro:actions`. To use `z` in your actions, import it from `astro:schema` instead: | ||
|
||
```diff | ||
import { | ||
defineAction, | ||
- z, | ||
} from 'astro:actions'; | ||
+ import { z } from 'astro:schema'; | ||
``` |
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,38 @@ | ||
--- | ||
"astro": minor | ||
--- | ||
|
||
The Astro Actions API introduced behind a flag in [v4.8.0](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#480) is no longer experimental and is available for general use. | ||
|
||
Astro Actions allow you to define and call backend functions with type-safety, performing data fetching, JSON parsing, and input validation for you. | ||
|
||
Actions can be called from client-side components and HTML forms. This gives you to flexibility to build apps using any technology: React, Svelte, HTMX, or just plain Astro components. This example calls a newsletter action and renders the result using an Astro component: | ||
|
||
```astro | ||
--- | ||
// src/pages/newsletter.astro | ||
import { actions } from 'astro:actions'; | ||
const result = Astro.getActionResult(actions.newsletter); | ||
--- | ||
{result && !result.error && <p>Thanks for signing up!</p>} | ||
<form method="POST" action={actions.newsletter}> | ||
<input type="email" name="email" /> | ||
<button>#</button> | ||
</form> | ||
``` | ||
|
||
If you were previously using this feature, please remove the experimental flag from your Astro config: | ||
|
||
```diff | ||
import { defineConfig } from 'astro' | ||
|
||
export default defineConfig({ | ||
- experimental: { | ||
- actions: true, | ||
- } | ||
}) | ||
``` | ||
|
||
If you have been waiting for stabilization before using Actions, you can now do so. | ||
|
||
For more information and usage examples, see our [brand new Actions guide](https://docs.astro.build/en/guides/actions). |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,4 @@ export default defineConfig({ | |
adapter: node({ | ||
mode: 'standalone', | ||
}), | ||
experimental: { | ||
actions: true, | ||
}, | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,4 @@ export default defineConfig({ | |
adapter: node({ | ||
mode: 'standalone', | ||
}), | ||
experimental: { | ||
actions: true, | ||
}, | ||
}); |
3 changes: 2 additions & 1 deletion
3
packages/astro/e2e/fixtures/actions-react-19/src/actions/index.ts
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
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
Oops, something went wrong.