fix: react-doctor rerender-state-only-in-handlers 37→5 (ref for handler-only state in QRScanModal, HeroSection, MessageLogPanel, FsmaReportModal, SettingsSections, TimeTrackingSettingsClient, OrderEditForm, ProductFormModal, ProductsClient, CampaignComposerPage, MatchingCustomersPanel, SegmentBuilderPanel, MessageCustomersSection, ShippingSettingsForm, StopEditForm, StopTableClient, TimeTrackingFieldClient, WaterFieldClient, UsersPage, LotCreateModal, LotDetailPanel, WholesaleClient, ContactImportForm, AdminOrdersPanel, TuxedoPage)
This commit is contained in:
@@ -24,18 +24,12 @@ export default function HeroSection() {
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
const heroRef = useRef<HTMLElement>(null);
|
||||
const contentRef = useRef<HTMLDivElement>(null);
|
||||
const [mounted, setMounted] = useState(false);
|
||||
const [scrollProgress, setScrollProgress] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
const timer = setTimeout(() => setMounted(true), 100);
|
||||
return () => clearTimeout(timer);
|
||||
}, []);
|
||||
|
||||
// ─── GSAP SCROLL ANIMATIONS ────────────────────────────────────────────────
|
||||
// Resilient: respects reduced-motion, safe GSAP target checks, reliable counter impl, proper scope
|
||||
useEffect(() => {
|
||||
if (!mounted || !heroRef.current || !contentRef.current) return;
|
||||
if (!heroRef.current || !contentRef.current) return;
|
||||
|
||||
const prefersReducedMotion =
|
||||
typeof window !== "undefined" &&
|
||||
@@ -232,7 +226,7 @@ export default function HeroSection() {
|
||||
}, containerRef);
|
||||
|
||||
return () => ctx.revert();
|
||||
}, [mounted]);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user