We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8fe8e21 commit e1709f8Copy full SHA for e1709f8
components/Layout/LayoutCart.vue
@@ -121,11 +121,32 @@ watch(
121
},
122
);
123
124
+/*
125
// Use a longer interval if you still want to use an interval
126
setInterval(() => {
127
if (cartChanged.value) {
128
cartChanged.value = false;
129
debouncedExecute();
130
}
-}, 5000);
131
+}, 5000);*/
132
+
133
+if (process.client) {
134
+ onMounted(() => {
135
+ const intervalId = setInterval(() => {
136
+ if (cartChanged.value) {
137
+ cartChanged.value = false;
138
+ debouncedExecute();
139
+ }
140
+ }, 5000);
141
142
+ // Clear the interval when the component is unmounted to prevent memory leaks
143
+ onBeforeUnmount(() => {
144
+ clearInterval(intervalId);
145
+ });
146
147
+}
148
149
150
151
152
</script>
0 commit comments