trpc-nuxt
trpc-nuxt copied to clipboard
fix: don't discard error in client
This resolves #9
The main issue is that the client tries to use serverError
from useState
and ignores the error
from useAsyncData
.
I'm not exactly sure how serverError
is populated. I assume it has something to do with SSR. However in case without SSR the returned error is always null
.
The proposed solution is to use the error from useAsyncData
as initial value for useState
.
const serverError = useState<TError | null>(`error-${key}`, () => error.value)
I'll test this locally. Thanks!