fix(nuxt): pass useFetch function name on server for warning (#31213)

Co-authored-by: "solovev.an" <andrey.solovyov.ccs@gmail.com>
This commit is contained in:
John Tanzer 2025-03-07 13:12:26 +02:00 committed by Daniel Roe
parent b29c0e86ba
commit bf454cb5bc
No known key found for this signature in database
GPG Key ID: 3714AB03996F442B

View File

@ -147,7 +147,7 @@ export function useFetch<
watch: watch === false ? [] : [_fetchOptions, _request, ...(watch || [])],
}
if (import.meta.dev && import.meta.client) {
if (import.meta.dev && import.meta.server) {
// @ts-expect-error private property
_asyncDataOptions._functionName = opts._functionName || 'useFetch'
}
@ -230,7 +230,7 @@ export function useLazyFetch<
) {
const [opts = {}, autoKey] = typeof arg1 === 'string' ? [{}, arg1] : [arg1, arg2]
if (import.meta.dev && import.meta.client) {
if (import.meta.dev && import.meta.server) {
// @ts-expect-error private property
opts._functionName ||= 'useLazyFetch'
}