Skip to content
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

fix: don't discard error in client #32

Merged
merged 2 commits into from Oct 28, 2022

Conversation

littlejon85
Copy link

@littlejon85 littlejon85 commented Oct 11, 2022

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)

@wobsoriano
Copy link
Owner

I'll test this locally. Thanks!

src/runtime/client.ts Outdated Show resolved Hide resolved
@wobsoriano wobsoriano merged commit bdeada0 into wobsoriano:master Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

useAsyncQuery doesn't set error in lazy component
2 participants