dont run autosync when not on page

This commit is contained in:
vabene1111
2025-03-16 16:11:08 +01:00
parent 8eb2ba9512
commit e29f318453

View File

@@ -236,6 +236,7 @@ import ShoppingListEntryInput from "@/components/inputs/ShoppingListEntryInput.v
import {DateTime} from "luxon";
import MealPlanEditor from "@/components/model_editors/MealPlanEditor.vue";
import ModelEditDialog from "@/components/dialogs/ModelEditDialog.vue";
import {onBeforeRouteLeave} from "vue-router";
const {t} = useI18n()
@@ -326,6 +327,13 @@ function autoSyncLoop() {
}, timeout)
}
/**
* cancel auto sync loop before leaving to another page
*/
onBeforeRouteLeave(() => {
clearTimeout(useShoppingStore().autoSyncTimeoutId)
})
/**
* delete shopping list recipe
*/