Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix: include highlightLines in lineProps deps array

Alaister Younga81ab2a9cd7a
diff --git a/www/components/CodeBlock/CodeBlock.tsx b/www/components/CodeBlock/CodeBlock.tsx
index 7d58ba65952..909a931625a 100644
--- a/www/components/CodeBlock/CodeBlock.tsx
+++ b/www/components/CodeBlock/CodeBlock.tsx
@@ -43,23 +43,26 @@ function CodeBlock(props: Props) {
// const large = props.size === 'large' ? true : false
const large = false
- const shouldHighlightLines = Boolean(props.highlightLines)
+ const shouldHighlightLines = props.highlightLines !== undefined
const highlightLines = useMemo(
() => new Set(rangeParser(props.highlightLines ?? '')),
[props.highlightLines]
)
- const lineProps = useCallback((lineNumber: number) => {
- const shouldHighlightLine = highlightLines.has(lineNumber)
+ const lineProps = useCallback(
+ (lineNumber: number) => {
+ const shouldHighlightLine = highlightLines.has(lineNumber)
- const transition = `filter 500ms ease, opacity 500ms ease`
+ const transition = `filter 500ms ease, opacity 500ms ease`
- const style = shouldHighlightLine
- ? { transition }
- : { transition, filter: 'grayscale(75%)', opacity: 0.5 }
+ const style = shouldHighlightLine
+ ? { transition }
+ : { transition, filter: 'grayscale(75%)', opacity: 0.5 }
- return { style }
- }, [])
+ return { style }
+ },
+ [highlightLines]
+ )
return (
<div className="relative">