From 459f74bc71748279fe7dce0688f38bd74b51c5c1 Mon Sep 17 00:00:00 2001 From: Martin Trapp <94928215+martrapp@users.noreply.github.com> Date: Fri, 23 Feb 2024 15:00:52 +0100 Subject: [PATCH] Adds an error message for non-string transition:name values (#10205) --- .changeset/pretty-oranges-heal.md | 5 +++++ packages/astro/src/runtime/server/transition.ts | 3 +++ 2 files changed, 8 insertions(+) create mode 100644 .changeset/pretty-oranges-heal.md diff --git a/.changeset/pretty-oranges-heal.md b/.changeset/pretty-oranges-heal.md new file mode 100644 index 000000000000..f1b8b38e0bc3 --- /dev/null +++ b/.changeset/pretty-oranges-heal.md @@ -0,0 +1,5 @@ +--- +"astro": patch +--- + +Adds an error message for non-string transition:name values diff --git a/packages/astro/src/runtime/server/transition.ts b/packages/astro/src/runtime/server/transition.ts index ec33e1eae482..755e64417ac2 100644 --- a/packages/astro/src/runtime/server/transition.ts +++ b/packages/astro/src/runtime/server/transition.ts @@ -91,6 +91,9 @@ export function renderTransition( animationName: TransitionAnimationValue | undefined, transitionName: string ) { + if (typeof (transitionName ?? '') !== 'string') { + throw new Error(`Invalid transition name {${transitionName}}`); + } // Default to `fade` (similar to `initial`, but snappier) if (!animationName) animationName = 'fade'; const scope = createTransitionScope(result, hash);