mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-07 09:22:27 +00:00
fix(nuxt): remove trailing slash before checking if prerendered (#24516)
This commit is contained in:
parent
1b1cc4f4e9
commit
5b4d638720
@ -1,4 +1,4 @@
|
|||||||
import { hasProtocol, joinURL } from 'ufo'
|
import { hasProtocol, joinURL, withoutTrailingSlash } from 'ufo'
|
||||||
import { parse } from 'devalue'
|
import { parse } from 'devalue'
|
||||||
import { useHead } from '@unhead/vue'
|
import { useHead } from '@unhead/vue'
|
||||||
import { getCurrentInstance } from 'vue'
|
import { getCurrentInstance } from 'vue'
|
||||||
@ -79,6 +79,7 @@ async function _importPayload (payloadURL: string) {
|
|||||||
export async function isPrerendered (url = useRoute().path) {
|
export async function isPrerendered (url = useRoute().path) {
|
||||||
// Note: Alternative for server is checking x-nitro-prerender header
|
// Note: Alternative for server is checking x-nitro-prerender header
|
||||||
if (!appManifest) { return !!useNuxtApp().payload.prerenderedAt }
|
if (!appManifest) { return !!useNuxtApp().payload.prerenderedAt }
|
||||||
|
url = withoutTrailingSlash(url)
|
||||||
const manifest = await getAppManifest()
|
const manifest = await getAppManifest()
|
||||||
if (manifest.prerendered.includes(url)) {
|
if (manifest.prerendered.includes(url)) {
|
||||||
return true
|
return true
|
||||||
|
Loading…
Reference in New Issue
Block a user