Skip to content

Commit

Permalink
chore: testing the test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
HigherOrderLogic committed Feb 17, 2024
1 parent 6499d80 commit 2aa4952
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/nuxt/src/pages/runtime/plugins/router.ts
Expand Up @@ -14,7 +14,7 @@ import { isEqual, withoutBase } from 'ufo'
import type { PageMeta } from '../composables'

import { toArray } from '../utils'
import { type Plugin, type RouteMiddleware, getRouteRules } from '#app'
import { type Plugin, type RouteMiddleware, getRouteRules, onNuxtReady } from '#app'
import { defineNuxtPlugin, useRuntimeConfig } from '#app/nuxt'
import { clearError, showError, useError } from '#app/composables/error'
import { navigateTo } from '#app/composables/router'
Expand Down Expand Up @@ -173,11 +173,17 @@ const plugin: Plugin<{ router: Router }> = defineNuxtPlugin({
}
}

const routeRules = await getRouteRules(to.fullPath);
if (routeRules.nuxtMiddleware) {
for (const middleware in routeRules.nuxtMiddleware) {
if (routeRules.nuxtMiddleware[middleware] === true) {
middlewareEntries.add(middleware)
let nuxtReady: boolean = false

onNuxtReady(() => nuxtReady = true)

if (nuxtReady) {
const routeRules = await getRouteRules(to.path);
if (routeRules.nuxtMiddleware) {
for (const middleware in routeRules.nuxtMiddleware) {
if (routeRules.nuxtMiddleware[middleware] === true) {
middlewareEntries.add(middleware)
}
}
}
}
Expand Down

0 comments on commit 2aa4952

Please sign in to comment.