fix: delete mutation observer

this may call render inifinity
This commit is contained in:
fantasticit
2022-05-20 22:43:17 +08:00
committed by GitHub
parent b9e6564511
commit d4db1a714f
-13
View File
@@ -40,19 +40,6 @@ export const useTheme = () => {
mql.addEventListener('change', matchMode);
}, []);
useEffect(() => {
const config = { attributes: true };
const callback = function () {
setTheme(document.body.getAttribute('theme-mode') as Theme);
};
const observer = new MutationObserver(callback);
observer.observe(document.body, config);
return () => {
observer.disconnect();
};
}, []);
return {
theme,
toggle,