fix: check key correctly

This commit is contained in:
Alexander Lichter 2024-06-26 10:40:50 +02:00
parent a7dde60be2
commit 9dea206001

View File

@ -142,10 +142,11 @@ export function generateRoutesFromFiles (files: ScannedFile[], options: Generate
export async function augmentPages (routes: NuxtPage[], vfs: Record<string, string>, augmentedPagesWithPaths = new Set<string>(), parentPath = '') { export async function augmentPages (routes: NuxtPage[], vfs: Record<string, string>, augmentedPagesWithPaths = new Set<string>(), parentPath = '') {
for (const route of routes) { for (const route of routes) {
if (route.file && !augmentedPagesWithPaths.has(route.file)) { const key = `${route.file}_${parentPath}${route.path}`
if (route.file && !augmentedPagesWithPaths.has(key)) {
const fileContent = route.file in vfs ? vfs[route.file] : fs.readFileSync(await resolvePath(route.file), 'utf-8') const fileContent = route.file in vfs ? vfs[route.file] : fs.readFileSync(await resolvePath(route.file), 'utf-8')
Object.assign(route, await getRouteMeta(fileContent, route.file)) Object.assign(route, await getRouteMeta(fileContent, route.file))
augmentedPagesWithPaths.add(`${route.file}_${parentPath}${route.path}`) augmentedPagesWithPaths.add(key)
} }
if (route.children && route.children.length > 0) { if (route.children && route.children.length > 0) {