Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@imbhargav5
Copy link
Owner

Summary

Refactor useMediaMatch to use React 18's useSyncExternalStore for better concurrent mode safety and proper SSR handling. The public API remains unchanged - this is an internal modernization with no breaking changes.

Key Improvements

  • Fixes Rules of Hooks violation (removed early return before hooks)
  • Concurrent mode safe - prevents tearing in React 18+ concurrent rendering
  • Proper SSR support via getServerSnapshot instead of conditional returns
  • Removes legacy addListener/removeListener API support (deprecated since Safari 14)
  • Cleaner, more maintainable implementation

Testing

All 1011 tests pass. TypeScript compilation succeeds with no errors.

🤖 Generated with Claude Code

@codesandbox
Copy link

codesandbox bot commented Dec 11, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@vercel
Copy link

vercel bot commented Dec 11, 2025

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

Project Deployment Preview Comments Updated (UTC)
rooks Ready Ready Preview Comment Dec 11, 2025 7:30am

@netlify
Copy link

netlify bot commented Dec 11, 2025

Deploy Preview for rooksjs ready!

Name Link
🔨 Latest commit fc6c09b
🔍 Latest deploy log https://app.netlify.com/projects/rooksjs/deploys/693a7294c71ce4000885f959
😎 Deploy Preview https://deploy-preview-1892--rooksjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Refactor useMediaMatch to use React 18's useSyncExternalStore for better concurrent mode safety and proper SSR handling. Fixes Rules of Hooks violation and removes legacy browser API support.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@imbhargav5 imbhargav5 force-pushed the modernize-usemediamatch branch from 3295d7c to 4cefe49 Compare December 11, 2025 07:27
@imbhargav5 imbhargav5 merged commit ea8fa8a into main Dec 11, 2025
7 of 8 checks passed
@imbhargav5 imbhargav5 deleted the modernize-usemediamatch branch December 11, 2025 07:31
@github-actions github-actions bot mentioned this pull request Dec 11, 2025
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.

2 participants