Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/nuxt/src/app/composables/asyncData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export function useAsyncData<

// Client side
if (process.client) {
if (fetchOnServer && nuxt.isHydrating) {
if (fetchOnServer && nuxt.isHydrating && key in nuxt.payload.data) {
// 1. Hydration (server: true): no fetch
asyncData.pending.value = false
} else if (instance && (nuxt.isHydrating || options.lazy)) {
Expand Down
5 changes: 4 additions & 1 deletion packages/nuxt/src/app/composables/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ export function useFetch<
request: Ref<ReqT> | ReqT | (() => ReqT),
opts: UseFetchOptions<_ResT, Transform, PickKeys> = {}
) {
const key = '$f_' + (opts.key || hash([request, opts]))
if (process.dev && opts.transform && !opts.key) {
console.warn('[nuxt] You should provide a key for `useFetch` when using a custom transform function.')
}
const key = '$f_' + (opts.key || hash([request, { ...opts, transform: null }]))
const _request = computed<FetchRequest>(() => {
let r = request
if (typeof r === 'function') {
Expand Down