mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-02 04:39:54 -05:00
dont run autosync when not on page
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user