From 3042a4b132f84d161e8d471f92bb52d876103b08 Mon Sep 17 00:00:00 2001 From: Mathias Oterhals Myklebust Date: Tue, 10 Sep 2024 15:34:48 +0200 Subject: [PATCH] fix(redirect): conditional type guard for preview props --- studio/schemas/documents/redirect.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/studio/schemas/documents/redirect.ts b/studio/schemas/documents/redirect.ts index 9c99a2fb1..969643d6b 100644 --- a/studio/schemas/documents/redirect.ts +++ b/studio/schemas/documents/redirect.ts @@ -110,8 +110,10 @@ const redirect = defineType({ if ( typeof sourceSlug !== "string" || typeof destinationType !== "string" || - typeof destinationReferenceSlug !== "string" || - typeof destinationExternalURL !== "string" + (destinationType === "reference" && + typeof destinationReferenceSlug !== "string") || + (destinationType === "external" && + typeof destinationExternalURL !== "string") ) { return {}; }