Skip to content

Commit

Permalink
fix(ui): css is not defined error in production build (#9603)
Browse files Browse the repository at this point in the history
Related: #9456
Fixes #9598

This ensures that the `CSS` property is accessed safely, preventing the
"CSS is not defined" error
  • Loading branch information
AlessioGr authored Nov 28, 2024
1 parent 3da9be0 commit 36a6a19
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/ui/src/elements/AnimateHeight/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client'
import React, { useEffect, useRef } from 'react'

import { usePatchAnimateHeight } from './usePatchAnimateHeight.js'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client'
import { useEffect, useMemo, useRef } from 'react'

export const usePatchAnimateHeight = ({
Expand All @@ -10,7 +11,10 @@ export const usePatchAnimateHeight = ({
open: boolean
}): { browserSupportsKeywordAnimation: boolean } => {
const browserSupportsKeywordAnimation = useMemo(
() => (CSS.supports ? Boolean(CSS.supports('interpolate-size', 'allow-keywords')) : false),
() =>
typeof CSS !== 'undefined' && CSS && CSS.supports
? Boolean(CSS.supports('interpolate-size', 'allow-keywords'))
: false,
[],
)

Expand Down

0 comments on commit 36a6a19

Please sign in to comment.