We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 70c6ab4 + 1450b19 commit e2c5706Copy full SHA for e2c5706
1 file changed
components/Layout.tsx
@@ -503,9 +503,16 @@ const FaviconHead = () => {
503
const matcher: MediaQueryList = window.matchMedia(
504
'(prefers-color-scheme: dark)',
505
);
506
- matcher.addEventListener('change', () => onUpdate(matcher));
+
507
+ const handleChange = () => onUpdate(matcher);
508
509
+ matcher.addEventListener('change', handleChange);
510
onUpdate(matcher);
- }, []);
511
512
+ return () => {
513
+ matcher.removeEventListener('change', handleChange);
514
+ };
515
+ }, [onUpdate]);
516
517
if (isDarkMode) {
518
return (
0 commit comments