diff options
author | 2024-07-30 11:42:52 -0400 | |
---|---|---|
committer | 2024-07-30 11:42:52 -0400 | |
commit | 1c3265a8c9c0b1b1bd597f756b63463146bacc3a (patch) | |
tree | 4bb2a89c1ed40d09263c1f6cd2ef4afffec964e3 /packages/integrations/react/server.js | |
parent | a77ed84759e9ca71938cfa836e2e645103d783c0 (diff) | |
download | astro-1c3265a8c9c0b1b1bd597f756b63463146bacc3a.tar.gz astro-1c3265a8c9c0b1b1bd597f756b63463146bacc3a.tar.zst astro-1c3265a8c9c0b1b1bd597f756b63463146bacc3a.zip |
Actions: Make `.safe()` the default return value (#11571)
* 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
Diffstat (limited to 'packages/integrations/react/server.js')
-rw-r--r-- | packages/integrations/react/server.js | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/packages/integrations/react/server.js b/packages/integrations/react/server.js index 6624a5610..16bf6785e 100644 --- a/packages/integrations/react/server.js +++ b/packages/integrations/react/server.js @@ -1,5 +1,4 @@ import opts from 'astro:react:opts'; -import { AstroError } from 'astro/errors'; import React from 'react'; import ReactDOM from 'react-dom/server'; import { incrementId } from './context.js'; @@ -151,17 +150,7 @@ async function getFormState({ result }) { if (!actionKey || !actionName) return undefined; - const isUsingSafe = formData.has('_astroActionSafe'); - if (!isUsingSafe && actionResult.error) { - throw new AstroError( - `Unhandled error calling action ${actionName.replace(/^\/_actions\//, '')}:\n[${ - actionResult.error.code - }] ${actionResult.error.message}`, - 'use `.safe()` to handle from your React component.' - ); - } - - return [isUsingSafe ? actionResult : actionResult.data, actionKey, actionName]; + return [actionResult, actionKey, actionName]; } async function renderToPipeableStreamAsync(vnode, options) { |