diff options
Diffstat (limited to 'packages/integrations/react/server.js')
-rw-r--r-- | packages/integrations/react/server.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/packages/integrations/react/server.js b/packages/integrations/react/server.js index 59134a699..6624a5610 100644 --- a/packages/integrations/react/server.js +++ b/packages/integrations/react/server.js @@ -131,6 +131,7 @@ async function getFormState({ result }) { if (!actionResult) return undefined; if (!isFormRequest(request.headers.get('content-type'))) return undefined; + const { searchParams } = new URL(request.url); const formData = await request.clone().formData(); /** * The key generated by React to identify each `useActionState()` call. @@ -142,7 +143,11 @@ async function getFormState({ result }) { * This matches the endpoint path. * @example "/_actions/blog.like" */ - const actionName = formData.get('_astroAction')?.toString(); + const actionName = + searchParams.get('_astroAction') ?? + /* Legacy. TODO: remove for stable */ formData + .get('_astroAction') + ?.toString(); if (!actionKey || !actionName) return undefined; |