You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In RTK Query's CodeGeneration, there is an issue with the generated code when encodeQueryParams is set to true. The current generated code outputs the following logic:
With this logic, if queryArg.status is '' or 0, it returns undefined, which results in the status query parameter being omitted from the request URL. However, I believe it is more natural for the values '' and 0 to be represented as ?status= and ?status=0 in query parameters. In fact, the behavior of URLSearchParams demonstrates this as follows:
In RTK Query's CodeGeneration, there is an issue with the generated code when
encodeQueryParams
is set totrue
. The current generated code outputs the following logic:With this logic, if
queryArg.status
is''
or0
, it returnsundefined
, which results in thestatus
query parameter being omitted from the request URL. However, I believe it is more natural for the values''
and0
to be represented as?status=
and?status=0
in query parameters. In fact, the behavior ofURLSearchParams
demonstrates this as follows:Therefore, in the generated code from the CodeGenerator, the logic should be correctly implemented as follows:
This code ensures that only
undefined
andnull
result inqueryArg.status
being undefined.The text was updated successfully, but these errors were encountered: