mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +00:00
fix(nuxt): don't load payloads for external urls (#8370)
This commit is contained in:
parent
a0a59e2157
commit
e1ab5cf6d6
@ -1,3 +1,4 @@
|
|||||||
|
import { parseURL } from 'ufo'
|
||||||
import { defineNuxtPlugin, loadPayload, isPrerendered, useRouter } from '#app'
|
import { defineNuxtPlugin, loadPayload, isPrerendered, useRouter } from '#app'
|
||||||
|
|
||||||
export default defineNuxtPlugin((nuxtApp) => {
|
export default defineNuxtPlugin((nuxtApp) => {
|
||||||
@ -8,7 +9,11 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load payload into cache
|
// Load payload into cache
|
||||||
nuxtApp.hooks.hook('link:prefetch', to => loadPayload(to))
|
nuxtApp.hooks.hook('link:prefetch', (url) => {
|
||||||
|
if (!parseURL(url).protocol) {
|
||||||
|
return loadPayload(url)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// Load payload after middleware & once final route is resolved
|
// Load payload after middleware & once final route is resolved
|
||||||
useRouter().beforeResolve(async (to, from) => {
|
useRouter().beforeResolve(async (to, from) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user