Skip to content

Commit

Permalink
Merge pull request #1282 from w3bdesign/dev
Browse files Browse the repository at this point in the history
Fix development errors
  • Loading branch information
w3bdesign authored Mar 16, 2024
2 parents 8afbba1 + 944ab81 commit 40b1818
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 39 deletions.
26 changes: 16 additions & 10 deletions components/Layout/LayoutCart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const updateCartDisplay = () => {
const remoteCartLength = data.value.cart.contents.nodes.reduce(
(total, product) => total + product.quantity,
0,
0
);
const remoteTotal = data.value.cart.contents.nodes.reduce(
Expand All @@ -83,7 +83,7 @@ const updateCartDisplay = () => {
const productTotal = Number(product.total.replace(/[^0-9.-]+/g, ""));
return total + productTotal;
},
0,
0
);
cartLength.value = remoteCartLength;
Expand Down Expand Up @@ -118,14 +118,20 @@ watch(
() => {
cartChanged.value = true;
debouncedExecute();
},
}
);
// Use a longer interval if you still want to use an interval
setInterval(() => {
if (cartChanged.value) {
cartChanged.value = false;
debouncedExecute();
}
}, 5000);
onMounted(() => {
const intervalId = setInterval(() => {
if (cartChanged.value) {
cartChanged.value = false;
debouncedExecute();
}
}, 5000);
// Clear the interval when the component is unmounted to prevent memory leaks
onBeforeUnmount(() => {
clearInterval(intervalId);
});
});
</script>
9 changes: 1 addition & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,11 @@
"prettier": "^3.2.5",
"tailwindcss": "^3.4.1"
},
"resolutions": {
"vue": "^3.4.21",
"tslib": "2.5.1"
},
"overrides": {
"vue": "^3.3.9",
"tslib": "2.6.2"
},
"dependencies": {
"@formkit/nuxt": "^1.6.0",
"@nuxtjs/algolia": "^1.10.1",
"@pinia/nuxt": "^0.5.1",
"graphql": "^16.8.1",
"lodash": "^4.17.21",
"pinia": "^2.1.7",
"swiper": "^10.3.1",
Expand Down
38 changes: 18 additions & 20 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion tests/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { test, expect } from "@playwright/test";

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

// Expect a title "to contain" a substring.
Expand Down

0 comments on commit 40b1818

Please sign in to comment.