Closed bryanwood closed 3 months ago
Astro v4.12.2 Node v18.20.3 System Linux (x64) Package Manager npm Output server Adapter none Integrations none
No response
When returning the number 0 from a server action an error occurs:
Response constructor: Invalid response status code 204
Cause appears to be this falsy check: https://github.com/withastro/astro/blob/7f26de906e87f1e8973a1f84399f23e36e506bb3/packages/astro/src/actions/runtime/route.ts#L43
Should this check for only null and undefined values?
null
undefined
A work around is to wrap the value in an object literal e.g. { number: 0 }
{ number: 0 }
The action returns the value 0.
https://stackblitz.com/edit/github-fozayp?file=src%2Fpages%2Findex.astro
It should probably use a != null check, feel free to send a PR!
!= null
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
When returning the number 0 from a server action an error occurs:
Response constructor: Invalid response status code 204
Cause appears to be this falsy check: https://github.com/withastro/astro/blob/7f26de906e87f1e8973a1f84399f23e36e506bb3/packages/astro/src/actions/runtime/route.ts#L43
Should this check for only
null
andundefined
values?A work around is to wrap the value in an object literal e.g.
{ number: 0 }
What's the expected result?
The action returns the value 0.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-fozayp?file=src%2Fpages%2Findex.astro
Participation