mirror of
https://github.com/fantasticit/think.git
synced 2026-10-31 07:09:04 +08:00
fix: delete mutation observer
this may call render inifinity
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user