-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: apply patch for syncing asyncData and nuxtData
nuxt/nuxt#22277. Dunno, but this does fix my issue
- Loading branch information
1 parent
e3c7f72
commit 0463b45
Showing
3 changed files
with
90 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
diff --git a/dist/app/composables/asyncData.js b/dist/app/composables/asyncData.js | ||
index d7ecff5ec0c17891f9eb6da15c68d59fef57d951..0851dfc675f6c2df32367cc48854c9e4104cc8b8 100644 | ||
--- a/dist/app/composables/asyncData.js | ||
+++ b/dist/app/composables/asyncData.js | ||
@@ -20,8 +20,8 @@ export function useAsyncData(...args) { | ||
options.lazy = options.lazy ?? false; | ||
options.immediate = options.immediate ?? true; | ||
const nuxt = useNuxtApp(); | ||
- const getCachedData = () => nuxt.isHydrating ? nuxt.payload.data[key] : nuxt.static.data[key]; | ||
- const hasCachedData = () => getCachedData() !== void 0; | ||
+ const getCachedData = () => nuxt.isHydrating ? toRef(nuxt.payload.data, key) : nuxt.static.data[key]; | ||
+ const hasCachedData = () => unref(getCachedData()) !== void 0; | ||
if (!nuxt._asyncData[key] || !options.immediate) { | ||
nuxt._asyncData[key] = { | ||
data: ref(getCachedData() ?? options.default()), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters