mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-07 15:18:20 -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 {DateTime} from "luxon";
|
||||||
import MealPlanEditor from "@/components/model_editors/MealPlanEditor.vue";
|
import MealPlanEditor from "@/components/model_editors/MealPlanEditor.vue";
|
||||||
import ModelEditDialog from "@/components/dialogs/ModelEditDialog.vue";
|
import ModelEditDialog from "@/components/dialogs/ModelEditDialog.vue";
|
||||||
|
import {onBeforeRouteLeave} from "vue-router";
|
||||||
|
|
||||||
const {t} = useI18n()
|
const {t} = useI18n()
|
||||||
|
|
||||||
@@ -326,6 +327,13 @@ function autoSyncLoop() {
|
|||||||
}, timeout)
|
}, timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cancel auto sync loop before leaving to another page
|
||||||
|
*/
|
||||||
|
onBeforeRouteLeave(() => {
|
||||||
|
clearTimeout(useShoppingStore().autoSyncTimeoutId)
|
||||||
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* delete shopping list recipe
|
* delete shopping list recipe
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user