fix(nuxt): check for layout after nextTick (#25197)

This commit is contained in:
Alexander Lichter 2024-01-14 17:03:08 +01:00 committed by GitHub
parent 3f4dfb39da
commit 49d4ae6112
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,3 +1,4 @@
import { nextTick } from 'vue'
import { defineNuxtPlugin } from '../nuxt'
import { onNuxtReady } from '../composables/ready'
import { useError } from '../composables/error'
@ -16,7 +17,7 @@ export default defineNuxtPlugin({
}
}
if (import.meta.server) {
nuxtApp.hook('app:rendered', checkIfLayoutUsed)
nuxtApp.hook('app:rendered', () => { nextTick(checkIfLayoutUsed) })
} else {
onNuxtReady(checkIfLayoutUsed)
}