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

code4recovery / tsml-ui / 18451009991

12 Oct 2025 11:29PM UTC coverage: 43.532% (-19.9%) from 63.458%
18451009991

Pull #475

github

web-flow
Merge 9d0374e51 into 0a0ddf96f
Pull Request #475: pretty permalinks

369 of 1009 branches covered (36.57%)

Branch coverage included in aggregate %.

15 of 37 new or added lines in 5 files covered. (40.54%)

236 existing lines in 17 files now uncovered.

553 of 1109 relevant lines covered (49.86%)

4.31 hits per line

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

0.0
/src/components/DynamicHeight.tsx
1
import { type PropsWithChildren, useEffect, useRef, useState } from 'react';
2

3
export default function DynamicHeight({ children }: PropsWithChildren) {
UNCOV
4
  const [occludedHeight, setOccludedHeight] = useState(0);
×
5

UNCOV
6
  useEffect(() => {
×
UNCOV
7
    window.addEventListener('resize', debouncedGetOccludedHeight);
×
UNCOV
8
    window.addEventListener('scroll', debouncedGetOccludedHeight);
×
UNCOV
9
    getOccludedHeight();
×
10

UNCOV
11
    return () => {
×
UNCOV
12
      window.removeEventListener('resize', debouncedGetOccludedHeight);
×
UNCOV
13
      window.removeEventListener('scroll', debouncedGetOccludedHeight);
×
14
    };
15
  }, []);
16

17
  // measure area covered up by fixed elements
UNCOV
18
  const getOccludedHeight = () => {
×
UNCOV
19
    const elements = document.body.getElementsByTagName('*');
×
UNCOV
20
    let occludedHeight = 0;
×
UNCOV
21
    for (const element of elements) {
×
UNCOV
22
      const style = window.getComputedStyle(element);
×
UNCOV
23
      if (
×
24
        style.position === 'fixed' &&
×
25
        parseFloat(style.width) === window.innerWidth
26
      ) {
27
        occludedHeight += parseFloat(style.height);
×
28
      }
29
    }
UNCOV
30
    setOccludedHeight(occludedHeight);
×
31
  };
32

UNCOV
33
  const timeoutId = useRef<ReturnType<typeof setTimeout>>();
×
34

UNCOV
35
  const debouncedGetOccludedHeight = () => {
×
36
    clearTimeout(timeoutId.current);
×
37
    timeoutId.current = setTimeout(getOccludedHeight, 250);
×
38
  };
39

UNCOV
40
  return (
×
41
    <div style={{ minHeight: `calc(100dvh - ${occludedHeight}px)` }}>
42
      {children}
43
    </div>
44
  );
45
}
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