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(nuxt): use $fetch.raw
in dev client mode for islands
#21904
Conversation
Run & review this pull request in StackBlitz Codeflow. |
@@ -81,7 +82,7 @@ export default defineComponent({ | |||
...props.context, | |||
props: props.props ? JSON.stringify(props.props) : undefined | |||
})) | |||
const result = await r.json() as NuxtIslandResponse | |||
const result = process.server ? await r.json() : (r as FetchResponse<NuxtIslandResponse>)._data |
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.
can we resolve this issue by just adding a .catch
block to r.json()
?
I also can't reproduce the issue on my end so my guess is that it's an issue with nitro's dev server socket + windows.
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.
Yes i already suspected that this was a windows issue. $fetch was solving this by rerunning the request.
Catching the .json
? Can't we check the response status (503) and refetch just like $fetch ?
Should we just allow an infinite refetch on 503 instead of a single catch ? It's quite rare but i can have up to 3 failed 503 request.
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.
Hm. It feels like this is an issue that needs to be resolved in Nitro rather than worked around in this kind of way. That said, I'm happy to merge this as a hotfix if essential.
Have you tried with the latest nitropack version? There was a fix merged that should have improved things on Windows.
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.
you're probably referring to unjs/nitro#1115 π€ ? on the edge version, i still have the 503 issue (nitropack 2.5.2)
would love to have someone on windows to also confirm this
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.
yes, exactly. any chance you could see if you can provide a pure nitro reproduction for @pi0?
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.
Sure π
NuxtIsland
$fetch.raw
in dev client mode for islands
π Linked issue
fix #21740
β Type of change
π Description
Hi π
There's currently a bug that can happen on client-side nav in dev mode (did not test build mode and don't know why this hasn't been detected by the fixtures tests).
bug reproduction:
islands
``NuxtLinkSometimes when navigating to a page containing a server component/island, we can have a 503 response by the server. With the native fetch API, this response isn't handled and breaks completly the page.
reproduction env
π Checklist