From 2f3dee9ba0c451d44f99940b816587b9e2968853 Mon Sep 17 00:00:00 2001 From: Teppo Kurki Date: Fri, 4 Oct 2024 14:54:29 +0300 Subject: [PATCH] fix: if config doesn't exist, add minimal one with flowLayout (#2793) * fix: if config doesn't exist, add minimal one with flowLayout --- .../file-router/src/vite-plugin/createViewConfigJson.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/ts/file-router/src/vite-plugin/createViewConfigJson.ts b/packages/ts/file-router/src/vite-plugin/createViewConfigJson.ts index eab23f6638..8f44459600 100644 --- a/packages/ts/file-router/src/vite-plugin/createViewConfigJson.ts +++ b/packages/ts/file-router/src/vite-plugin/createViewConfigJson.ts @@ -74,9 +74,13 @@ export default async function createViewConfigJson(views: readonly RouteMeta[]): } } + if (config === undefined) { + config = { flowLayout: flowLayout ?? false }; + } + let title: string; - if (config?.title) { + if (config.title) { ({ title } = config); } else { if (!componentName) { @@ -91,7 +95,7 @@ export default async function createViewConfigJson(views: readonly RouteMeta[]): return { route: convertFSRouteSegmentToURLPatternFormat(path), ...config, - params: extractParameterFromRouteSegment(config?.route ?? path), + params: extractParameterFromRouteSegment(config.route ?? path), title, children: newChildren ?? (layout ? [] : undefined), } satisfies ServerViewConfig;