Skip to content

fix: stabilize repeated lifecycle effects in landing experience - #46

Open
amberly-d wants to merge 1 commit into
Proof-Stell:mainfrom
amberly-d:fix/stabilize-lifecycle-effects
Open

fix: stabilize repeated lifecycle effects in landing experience#46
amberly-d wants to merge 1 commit into
Proof-Stell:mainfrom
amberly-d:fix/stabilize-lifecycle-effects

Conversation

@amberly-d

Copy link
Copy Markdown

Description

Extracts inline timers, scroll listeners, and fetch/polling logic from landing page components into dedicated reusable hooks with proper cleanup semantics and unmount guards.

Closes #19

Key Changes

  • useVerificationSimulation hook: Extracts hero section timer logic (step progression, verified state) with isMounted guard and interval cleanup
  • useLeaderboardData hook: Extracts leaderboard fetch + polling logic with AbortController cancellation and isMounted guard
  • useScrolled hook: Extracts scroll position tracking with passive listener and cleanup
  • Refactored components: HeroSection, LeaderboardSection, Navbar now use the new hooks instead of inline effects
  • 13 unit tests: Covering timer progression, cleanup on unmount, fetch/polling behavior, scroll threshold

Testing

  • npm run test — all 13 new lifecycle hook tests pass, all existing tests unaffected
  • npm run build — only pre-existing import.meta.vitest type error in errorHandler.ts

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Extracts inline timers, scroll listeners, and fetch/polling logic into
dedicated hooks (useVerificationSimulation, useLeaderboardData,
useScrolled) with proper cleanup semantics and unmount guards.
Closes Proof-Stell#19.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stabilize repeated lifecycle effects in the landing experience

1 participant