• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

clippingkk / web / #1183

10 Dec 2025 04:53PM UTC coverage: 0.526% (+0.006%) from 0.52%
#1183

push

web-flow
Merge b5c98262e into b46e895d7

30 of 446 branches covered (6.73%)

Branch coverage included in aggregate %.

2 of 394 new or added lines in 116 files covered. (0.51%)

35 existing lines in 8 files now uncovered.

147 of 33222 relevant lines covered (0.44%)

8.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/components/SimpleAnimation/HideUntilLoaded.tsx
1
'use client'
×
2
import type React from 'react'
×
3
import { useEffect, useState } from 'react'
×
4

×
5
type HideUntilLoadedProps = {
×
6
  imageToLoad: string
×
7
  children: React.ReactElement
×
8
}
×
9

×
NEW
10
// Inner component that resets via key prop when imageToLoad changes
×
NEW
11
function HideUntilLoadedInner({
×
NEW
12
  imageToLoad,
×
NEW
13
  children,
×
NEW
14
}: HideUntilLoadedProps) {
×
NEW
15
  const [status, setStatus] = useState<'loading' | 'loaded' | 'error'>(
×
NEW
16
    'loading'
×
NEW
17
  )
×
18

×
19
  useEffect(() => {
×
20
    const img = document.createElement('img')
×
NEW
21
    img.onload = () => setStatus('loaded')
×
NEW
22
    img.onerror = () => setStatus('error')
×
NEW
23
    img.src = imageToLoad
×
NEW
24

×
NEW
25
    return () => {
×
NEW
26
      img.onload = null
×
NEW
27
      img.onerror = null
×
28
    }
×
NEW
29
  }, [imageToLoad])
×
NEW
30

×
NEW
31
  if (status === 'error') {
×
NEW
32
    return children
×
33
  }
×
34

×
NEW
35
  if (status === 'loading') {
×
36
    return null
×
37
  }
×
38

×
NEW
39
  return children
×
NEW
40
}
×
NEW
41

×
NEW
42
function HideUntilLoaded(props: HideUntilLoadedProps) {
×
NEW
43
  // Use key prop to reset component state when imageToLoad changes
×
NEW
44
  return <HideUntilLoadedInner key={props.imageToLoad} {...props} />
×
45
}
×
46

×
47
export default HideUntilLoaded
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc