Unverified Commit 0bc1b7ec authored by Shu Ding's avatar Shu Ding Committed by GitHub

Skip handler for POST requests when no action ID is found (#49119)

Closes #48204. This shouldn't be a hard error but we should just
silently ignore.
parent 194da0b3
...@@ -95,7 +95,8 @@ export async function handleAction({ ...@@ -95,7 +95,8 @@ export async function handleAction({
actionId = formData.get('$$id') as string actionId = formData.get('$$id') as string
if (!actionId) { if (!actionId) {
throw new Error('Invariant: missing action ID.') // Return if no action ID is found, it could be a regular POST request
return
} }
formData.delete('$$id') formData.delete('$$id')
bound = [formData] bound = [formData]
...@@ -124,7 +125,8 @@ export async function handleAction({ ...@@ -124,7 +125,8 @@ export async function handleAction({
if (isFormAction) { if (isFormAction) {
actionId = actionData.$$id as string actionId = actionData.$$id as string
if (!actionId) { if (!actionId) {
throw new Error('Invariant: missing action ID.') // Return if no action ID is found, it could be a regular POST request
return
} }
const formData = formDataFromSearchQueryString(actionData) const formData = formDataFromSearchQueryString(actionData)
formData.delete('$$id') formData.delete('$$id')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment