mirror of
https://github.com/withastro/astro.git
synced 2025-01-20 22:12:38 -05:00
1c3265a8c9
* feat: new orThrow types * fix: parens on return type * feat: switch implementation to orThrow() * feat(e2e): update PostComment * fix: remove callSafely from middleware * fix: toString() for actions * fix(e2e): more orThrow updates * feat: remove progressive enhancement from orThrow * fix: remove _astroActionSafe handler from react * feat(e2e): update test to use safe calling * chore: console log * chore: unused import * fix: add rewriting: true to test fixture * fix: correctly throw for server-only actions * chore: changeset * fix: update type tests * fix(test): remove .safe() chain * docs: use "patch" with BREAKING CHANGE notice * docs: clarify react integration in changeset
857 B
857 B
@astrojs/react | astro |
---|---|
patch | patch |
BREAKING CHANGE to the experimental Actions API only. Install the latest @astrojs/react
integration as well if you're using React 19 features.
Make .safe()
the default return value for actions. This means { data, error }
will be returned when calling an action directly. If you prefer to get the data while allowing errors to throw, chain the .orThrow()
modifier.
import { actions } from 'astro:actions';
// Before
const { data, error } = await actions.like.safe();
// After
const { data, error } = await actions.like();
// Before
const newLikes = await actions.like();
// After
const newLikes = await actions.like.orThrow();
Migration
To migrate your existing action calls:
- Remove
.safe
from existing safe action calls - Add
.orThrow
to existing unsafe action calls