Skip to content

refactor(useLogoSoup): parallelize image loading, use reducer for state#5

Merged
RostiMelk merged 3 commits intomainfrom
fix/use-reducer-parallel-logos
Feb 6, 2026
Merged

refactor(useLogoSoup): parallelize image loading, use reducer for state#5
RostiMelk merged 3 commits intomainfrom
fix/use-reducer-parallel-logos

Conversation

@RostiMelk
Copy link
Member

@RostiMelk RostiMelk commented Feb 6, 2026

  • Replace sequential for loop with Promise.allSettled for parallel image loading
  • Replace 3 independent useState calls with useReducer for atomic state transitions
  • Fix stale data/error inconsistency when inputs change
  • Stabilize logos array dep via content comparison to prevent infinite re-render loop
  • Fix test environment: set NODE_ENV=development so React loads dev build with act() support
  • Fix broken normalize test import path
  • Clean up test mocks (queueMicrotask instead of setTimeout) and remove unused code
  • No API changes

…state

- Replace sequential for loop with Promise.allSettled
- Replace 3 independent useState calls with useReducer for atomic state transitions
- Fix stale data/error inconsistency when inputs change
- Early-exit cancelled tasks after image load to skip measurement work
@vercel
Copy link

vercel bot commented Feb 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
react-logo-soup Ready Ready Preview, Comment Feb 6, 2026 10:53am

Request Review

@RostiMelk RostiMelk changed the base branch from move-static-assets to main February 6, 2026 10:25
- Stabilize logos array reference via content comparison to prevent infinite re-render loop
- Move logosEqual to utils/normalize
- Set NODE_ENV=development in bunfig.toml so React loads dev build with act() support
- Fix normalize test import path (src/normalize -> src/utils/normalize)
- Replace setTimeout with queueMicrotask in mocks to resolve act() warning
- Remove unused imports and dead code from test file
- Combine filter().map() into single loop per React best practices
@RostiMelk RostiMelk merged commit 309f731 into main Feb 6, 2026
3 checks passed
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.

1 participant