Skip to content

Commit b83c98c

Browse files
authored
Merge pull request #153 from keploy/fix-hydration-issue
fix: hydration issues
2 parents 938db9b + dc1bd72 commit b83c98c

25 files changed

+698
-666
lines changed

app/(default)/case-studies/page.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ export default function Home() {
108108
viewBox="0 0 24 24"
109109
fill="none"
110110
stroke="currentColor"
111-
stroke-width="2"
112-
stroke-linecap="round"
113-
stroke-linejoin="round"
111+
strokeWidth="2"
112+
strokeLinecap="round"
113+
strokeLinejoin="round"
114114
>
115115
<path d="m9 18 6-6-6-6" />
116116
</svg>

app/(default)/webstories/css/CircularLoader.module.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
.backgroundCircle {
1616
fill: none;
1717
stroke: #e2a26d;
18-
stroke-width: 10;
18+
strokeWidth: 10;
1919
}
2020

2121
.progressCircle {
2222
fill: none;
2323
stroke: #d84f06;
24-
stroke-width: 10;
24+
strokeWidth: 10;
2525
stroke-dasharray: 283; /* 2 * Math.PI * 45 (radius) */
2626
stroke-dashoffset: 283; /* Initially hidden */
2727
transition: stroke-dashoffset 0.3s linear;

app/layout.tsx

+118-84
Large diffs are not rendered by default.

components/FeatureMoblieView.tsx

+141-162
Large diffs are not rendered by default.

components/Particles.tsx

+12-10
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@ interface MousePosition {
77
y: number;
88
}
99

10-
function MousePosition(): MousePosition {
11-
const [mousePosition, setMousePosition] = useState<MousePosition>({
12-
x: 0,
13-
y: 0,
14-
});
10+
function useMousePosition(): MousePosition {
11+
const [mousePosition, setMousePosition] = useState<MousePosition>({ x: 0, y: 0 });
1512

1613
useEffect(() => {
1714
const handleMouseMove = (event: MouseEvent) => {
@@ -71,10 +68,15 @@ const Particles: React.FC<ParticlesProps> = ({
7168
const canvasContainerRef = useRef<HTMLDivElement>(null);
7269
const context = useRef<CanvasRenderingContext2D | null>(null);
7370
const circles = useRef<any[]>([]);
74-
const mousePosition = MousePosition();
71+
const mousePosition = useMousePosition();
7572
const mouse = useRef<{ x: number; y: number }>({ x: 0, y: 0 });
7673
const canvasSize = useRef<{ w: number; h: number }>({ w: 0, h: 0 });
77-
const dpr = typeof window !== "undefined" ? window.devicePixelRatio : 1;
74+
75+
// Defer devicePixelRatio calculation to client
76+
const [dpr, setDpr] = useState(1);
77+
useEffect(() => {
78+
setDpr(window.devicePixelRatio);
79+
}, []);
7880

7981
useEffect(() => {
8082
if (canvasRef.current) {
@@ -87,7 +89,7 @@ const Particles: React.FC<ParticlesProps> = ({
8789
return () => {
8890
window.removeEventListener("resize", initCanvas);
8991
};
90-
}, [color]);
92+
}, [color, dpr]);
9193

9294
useEffect(() => {
9395
onMouseMove();
@@ -116,7 +118,7 @@ const Particles: React.FC<ParticlesProps> = ({
116118
}
117119
};
118120

119-
interface Circle {
121+
interface Circle {
120122
x: number;
121123
y: number;
122124
translateX: number;
@@ -127,7 +129,7 @@ const Particles: React.FC<ParticlesProps> = ({
127129
dx: number;
128130
dy: number;
129131
magnetism: number;
130-
};
132+
}
131133

132134
const resizeCanvas = () => {
133135
if (canvasContainerRef.current && canvasRef.current && context.current) {

components/atg/terminal.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ function CombinedTerminalPage({
463463
promptLabel={
464464
<p className="font-bold flex">
465465
{Emoji}
466-
<p className="text-accent-100">~/$</p>
466+
<span className="text-accent-100">~/$</span>
467467
</p>
468468
}
469469
commands={commands}

components/caseStudyCard.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ export default function CaseStudyCard({
4949
viewBox="0 0 24 24"
5050
fill="none"
5151
stroke="currentColor"
52-
stroke-width="2"
53-
stroke-linecap="round"
54-
stroke-linejoin="round"
52+
strokeWidth="2"
53+
strokeLinecap="round"
54+
strokeLinejoin="round"
5555
>
5656
<path d="m9 18 6-6-6-6" />
5757
</svg>

components/caseStudySearch.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ export default function CaseStudySearch({setSearch}: caseStudySearchProps) {
3535
viewBox="0 0 24 24"
3636
fill="none"
3737
stroke="currentColor"
38-
stroke-width="2"
39-
stroke-linecap="round"
40-
stroke-linejoin="round"
38+
strokeWidth="2"
39+
strokeLinecap="round"
40+
strokeLinejoin="round"
4141
>
4242
<circle cx="11" cy="11" r="8" />
4343
<path d="m21 21-4.3-4.3" />

components/nav/UpIcon.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const UpIcon = ({ className }) => (
2-
<svg className={className} height="12px" width="12px" viewBox="0 0 407.436 407.436" xmlns="http://www.w3.org/2000/svg">
3-
<polygon fill="currentColor" points="203.718,91.567 0,294.621 21.179,315.869 203.718,133.924 386.258,315.869 407.436,294.621" />
4-
</svg>
5-
);
2+
<svg className={className} height="12px" width="12px" viewBox="0 0 407.436 407.436" xmlns="http://www.w3.org/2000/svg">
3+
<polygon fill="currentColor" points="203.718,91.567 0,294.621 21.179,315.869 203.718,133.924 386.258,315.869 407.436,294.621" />
4+
</svg>
5+
);

components/nav/solutionsSection.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ export default function Solutions() {
135135
href={item.url}
136136
className="flex items-center gap-3 font-semibold hover:text-primary-500 transition-colors duration-200 h-[24px]"
137137
>
138-
<div className="h-6 w-6 flex-shrink-0 flex items-center justify-center">{item.icon}</div>
138+
<div className="h-6 w-6 flex-shrink-0 flex items-center justify-center">
139+
{item.icon}
140+
</div>
139141
<span>{item.name}</span>
140142
</a>
141143
</li>

components/webstories/Stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const Stories = ({
7474
};
7575

7676
const handleSwipeUp = () => {
77-
window.location.href = "/webstories";
77+
router.push("/webstories");
7878
};
7979

8080
const handleLongPress = () => {

0 commit comments

Comments
 (0)