Skip to content

Commit 944ab81

Browse files
committed
Update LayoutCart.vue
1 parent 9cd1e88 commit 944ab81

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

components/Layout/LayoutCart.vue

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -121,19 +121,17 @@ watch(
121121
}
122122
);
123123
124-
if (process.client) {
125-
onMounted(() => {
126-
const intervalId = setInterval(() => {
127-
if (cartChanged.value) {
128-
cartChanged.value = false;
129-
debouncedExecute();
130-
}
131-
}, 5000);
132-
133-
// Clear the interval when the component is unmounted to prevent memory leaks
134-
onBeforeUnmount(() => {
135-
clearInterval(intervalId);
136-
});
124+
onMounted(() => {
125+
const intervalId = setInterval(() => {
126+
if (cartChanged.value) {
127+
cartChanged.value = false;
128+
debouncedExecute();
129+
}
130+
}, 5000);
131+
132+
// Clear the interval when the component is unmounted to prevent memory leaks
133+
onBeforeUnmount(() => {
134+
clearInterval(intervalId);
137135
});
138-
}
136+
});
139137
</script>

0 commit comments

Comments
 (0)