mirror of https://github.com/fantasticit/think.git
fix: delete mutation observer
this may call render inifinity
This commit is contained in:
parent
b9e6564511
commit
d4db1a714f
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue