Co-authored-by: wolfoftyreso-debug <250630591+wolfoftyreso-debug@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-07-11 10:40:22 +00:00
parent 242d1e6cc5
commit db0404f93b
3 changed files with 0 additions and 440 deletions
-15
View File
@@ -1,15 +0,0 @@
import { useEffect } from 'react';
import { useCartStore } from '@/stores/cartStore';
export function useCartSync() {
const syncCart = useCartStore(state => state.syncCart);
useEffect(() => {
syncCart();
const handleVisibilityChange = () => {
if (document.visibilityState === 'visible') syncCart();
};
document.addEventListener('visibilitychange', handleVisibilityChange);
return () => document.removeEventListener('visibilitychange', handleVisibilityChange);
}, [syncCart]);
}