Skip to content

Commit 40b1818

Browse files
authored
Merge pull request #1282 from w3bdesign/dev
Fix development errors
2 parents 8afbba1 + 944ab81 commit 40b1818

File tree

4 files changed

+35
-39
lines changed

4 files changed

+35
-39
lines changed

components/Layout/LayoutCart.vue

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const updateCartDisplay = () => {
7474
7575
const remoteCartLength = data.value.cart.contents.nodes.reduce(
7676
(total, product) => total + product.quantity,
77-
0,
77+
0
7878
);
7979
8080
const remoteTotal = data.value.cart.contents.nodes.reduce(
@@ -83,7 +83,7 @@ const updateCartDisplay = () => {
8383
const productTotal = Number(product.total.replace(/[^0-9.-]+/g, ""));
8484
return total + productTotal;
8585
},
86-
0,
86+
0
8787
);
8888
8989
cartLength.value = remoteCartLength;
@@ -118,14 +118,20 @@ watch(
118118
() => {
119119
cartChanged.value = true;
120120
debouncedExecute();
121-
},
121+
}
122122
);
123123
124-
// Use a longer interval if you still want to use an interval
125-
setInterval(() => {
126-
if (cartChanged.value) {
127-
cartChanged.value = false;
128-
debouncedExecute();
129-
}
130-
}, 5000);
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);
135+
});
136+
});
131137
</script>

package.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,11 @@
2222
"prettier": "^3.2.5",
2323
"tailwindcss": "^3.4.1"
2424
},
25-
"resolutions": {
26-
"vue": "^3.4.21",
27-
"tslib": "2.5.1"
28-
},
29-
"overrides": {
30-
"vue": "^3.3.9",
31-
"tslib": "2.6.2"
32-
},
3325
"dependencies": {
3426
"@formkit/nuxt": "^1.6.0",
3527
"@nuxtjs/algolia": "^1.10.1",
3628
"@pinia/nuxt": "^0.5.1",
29+
"graphql": "^16.8.1",
3730
"lodash": "^4.17.21",
3831
"pinia": "^2.1.7",
3932
"swiper": "^10.3.1",

pnpm-lock.yaml

Lines changed: 18 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/index.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { test, expect } from "@playwright/test";
22

33
test("Has Index title", async ({ page }) => {
4-
//await page.goto('https://playwright.dev/');
54
await page.goto("/");
65

76
// Expect a title "to contain" a substring.

0 commit comments

Comments
 (0)