Skip to content

Commit

Permalink
Adds an error message for non-string transition:name values
Browse files Browse the repository at this point in the history
  • Loading branch information
martrapp committed Feb 22, 2024
1 parent 31a9f84 commit 7f10715
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/pretty-oranges-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": patch
---

Adds an error message for non-string transition:name values
3 changes: 3 additions & 0 deletions packages/astro/src/runtime/server/transition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7f10715

Please sign in to comment.