Fix tracking empty preset code in init routes

Guard against tracking an empty preset value in both /init and /init/v0
routes. When no valid preset code is in the URL, getPresetCode encodes
one from the parsed config params. The conditional spread ensures an
empty string never reaches analytics.

https://claude.ai/code/session_018Mm7WJAaSUGSqamSm3RiyC
This commit is contained in:
Claude
2026-03-21 10:15:16 +00:00
parent 900f099583
commit 95e8ef9939

View File

@@ -25,7 +25,7 @@ export async function GET(request: NextRequest) {
after(() => {
track("create_open_in_v0", {
...result.data,
preset: presetCode,
...(presetCode && { preset: presetCode }),
})
})