From 4c9933c1f3f0d3c02a7f2d2df9a40298db0ebb19 Mon Sep 17 00:00:00 2001 From: Himanshu-Lilhore Date: Thu, 12 Mar 2026 18:38:46 +0530 Subject: [PATCH] fix: handle SSR error in TargetCursor component by checking for window object & fixed duplicate id in sponsors constant --- src/constants/Sponsors.js | 2 +- src/content/Animations/TargetCursor/TargetCursor.jsx | 1 + src/tailwind/Animations/TargetCursor/TargetCursor.jsx | 1 + src/ts-default/Animations/TargetCursor/TargetCursor.tsx | 1 + src/ts-tailwind/Animations/TargetCursor/TargetCursor.tsx | 1 + 5 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/constants/Sponsors.js b/src/constants/Sponsors.js index 138644066..e4a3715b2 100644 --- a/src/constants/Sponsors.js +++ b/src/constants/Sponsors.js @@ -7,7 +7,7 @@ export const diamondSponsors = [ url: 'https://www.shadcnblocks.com/' }, { - id: 1, + id: 2, name: 'shadcn studio', imageUrl: '/assets/sponsors/shadcnstudio.svg', url: 'https://shadcnstudio.com/' diff --git a/src/content/Animations/TargetCursor/TargetCursor.jsx b/src/content/Animations/TargetCursor/TargetCursor.jsx index 57689563f..595c2b4db 100644 --- a/src/content/Animations/TargetCursor/TargetCursor.jsx +++ b/src/content/Animations/TargetCursor/TargetCursor.jsx @@ -20,6 +20,7 @@ const TargetCursor = ({ const activeStrengthRef = useRef(0); const isMobile = useMemo(() => { + if (typeof window === 'undefined') return false; const hasTouchScreen = 'ontouchstart' in window || navigator.maxTouchPoints > 0; const isSmallScreen = window.innerWidth <= 768; const userAgent = navigator.userAgent || navigator.vendor || window.opera; diff --git a/src/tailwind/Animations/TargetCursor/TargetCursor.jsx b/src/tailwind/Animations/TargetCursor/TargetCursor.jsx index 3ecbbb814..9c318865d 100644 --- a/src/tailwind/Animations/TargetCursor/TargetCursor.jsx +++ b/src/tailwind/Animations/TargetCursor/TargetCursor.jsx @@ -19,6 +19,7 @@ const TargetCursor = ({ const activeStrengthRef = useRef(0); const isMobile = useMemo(() => { + if (typeof window === 'undefined') return false; const hasTouchScreen = 'ontouchstart' in window || navigator.maxTouchPoints > 0; const isSmallScreen = window.innerWidth <= 768; const userAgent = navigator.userAgent || navigator.vendor || window.opera; diff --git a/src/ts-default/Animations/TargetCursor/TargetCursor.tsx b/src/ts-default/Animations/TargetCursor/TargetCursor.tsx index 16416ed87..b77cb7cce 100644 --- a/src/ts-default/Animations/TargetCursor/TargetCursor.tsx +++ b/src/ts-default/Animations/TargetCursor/TargetCursor.tsx @@ -28,6 +28,7 @@ const TargetCursor: React.FC = ({ const activeStrengthRef = useRef({ current: 0 }); const isMobile = useMemo(() => { + if (typeof window === 'undefined') return false; const hasTouchScreen = 'ontouchstart' in window || navigator.maxTouchPoints > 0; const isSmallScreen = window.innerWidth <= 768; const userAgent = navigator.userAgent || navigator.vendor || (window as any).opera; diff --git a/src/ts-tailwind/Animations/TargetCursor/TargetCursor.tsx b/src/ts-tailwind/Animations/TargetCursor/TargetCursor.tsx index 42d624c53..453435dee 100644 --- a/src/ts-tailwind/Animations/TargetCursor/TargetCursor.tsx +++ b/src/ts-tailwind/Animations/TargetCursor/TargetCursor.tsx @@ -27,6 +27,7 @@ const TargetCursor: React.FC = ({ const activeStrengthRef = useRef({ current: 0 }); const isMobile = useMemo(() => { + if (typeof window === 'undefined') return false; const hasTouchScreen = 'ontouchstart' in window || navigator.maxTouchPoints > 0; const isSmallScreen = window.innerWidth <= 768; const userAgent = navigator.userAgent || navigator.vendor || (window as any).opera;