Skip to content

Commit

Permalink
Adds an error message for non-string transition:name values (#10205)
Browse files Browse the repository at this point in the history
  • Loading branch information
martrapp authored Feb 23, 2024
1 parent dddbb09 commit 459f74b
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 459f74b

Please sign in to comment.