-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fetchBaseQuery: return null
on empty body for JSON. Add DevWarnings.
#1699
Conversation
size-limit report 📦
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 50cf1ef:
|
queryFn
returns a wrong shapenull
instead of undefined
on empty body for JSON. add dev errors if baseQuery
/queryFn
returns a wrong shape
@@ -54,7 +54,7 @@ const handleResponse = async ( | |||
|
|||
if (responseHandler === 'json') { | |||
const text = await response.text() | |||
return text.length ? JSON.parse(text) : undefined | |||
return text.length ? JSON.parse(text) : null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this is a almost-breaking change, but a very minor one.
It is necessary as we cannot serialize undefined
when transferring data from server to client in SSR scenarios.
null
instead of undefined
on empty body for JSON. add dev errors if baseQuery
/queryFn
returns a wrong shapenull
on empty body for JSON. Add DevWarnings.
Just something I wanted to do for a while.