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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 13 deletions

View File

@ -40,19 +40,6 @@ export const useTheme = () => {
mql.addEventListener('change', matchMode); 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 { return {
theme, theme,
toggle, toggle,