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
Are all your remix dependencies & dev-dependencies using the same version?
Yes
Steps to Reproduce
ShouldRevalidateFunction's actionResult argument is of type DataResult, which is defined below. However, actionResult really just holds the data returned by the result.
So if my action returns json({ok: true})actionData will be {ok: true}. None of the keys from SuccessResult below are actually in the object. And if I return something like json({error: "my error"}, {status: 422}), there's no way to see that status code in my shouldRevalidate function, because all I get is {error: "my error"}. This means I have to bypass the type of actionResult and rely on the shape of the data, instead of using the HTTP status codes to know if my action was successful or not.
exportdeclareenumResultType{data="data",deferred="deferred",redirect="redirect",error="error"}/** * Successful result from a loader or action */exportinterfaceSuccessResult{type: ResultType.data;data: any;statusCode?: number;headers?: Headers;}/** * Successful defer() result from a loader or action */exportinterfaceDeferredResult{type: ResultType.deferred;deferredData: DeferredData;statusCode?: number;headers?: Headers;}/** * Redirect result from a loader or action */exportinterfaceRedirectResult{type: ResultType.redirect;status: number;location: string;revalidate: boolean;}/** * Unsuccessful result from a loader or action */exportinterfaceErrorResult{type: ResultType.error;error: any;headers?: Headers;}/** * Result from a loader or action - potentially successful or unsuccessful */exportdeclaretypeDataResult=SuccessResult|DeferredResult|RedirectResult|ErrorResult;
Expected Behavior
Either actionResult should just by typed to AppData (which defaults to any) similar to useActionData()'s type, or the result should be returned in the DataResult format.
Actual Behavior
actionResult is of type DataResult which doesn't match it's actual data.
The text was updated successfully, but these errors were encountered:
What version of Remix are you using?
1.14.1
Are all your remix dependencies & dev-dependencies using the same version?
Steps to Reproduce
ShouldRevalidateFunction
'sactionResult
argument is of typeDataResult
, which is defined below. However,actionResult
really just holds the data returned by the result.So if my action returns
json({ok: true})
actionData
will be{ok: true}
. None of the keys fromSuccessResult
below are actually in the object. And if I return something likejson({error: "my error"}, {status: 422})
, there's no way to see that status code in myshouldRevalidate
function, because all I get is{error: "my error"}
. This means I have to bypass the type ofactionResult
and rely on the shape of the data, instead of using the HTTP status codes to know if my action was successful or not.Expected Behavior
Either
actionResult
should just by typed toAppData
(which defaults toany
) similar touseActionData()
's type, or the result should be returned in theDataResult
format.Actual Behavior
actionResult
is of typeDataResult
which doesn't match it's actual data.The text was updated successfully, but these errors were encountered: