fix: Infinite API request loop on empty stores (#7613)

This commit is contained in:
Michael Genson
2026-05-12 12:25:48 -05:00
committed by GitHub
parent 703db2931f
commit af75c5f39d
12 changed files with 82 additions and 22 deletions

View File

@@ -5,10 +5,12 @@ import { useUserApi } from "~/composables/api";
const store: Ref<MultiPurposeLabelOut[]> = ref([]);
const loading = ref(false);
const initialized = ref(false);
export function resetLabelStore() {
store.value = [];
loading.value = false;
initialized.value = false;
}
export const useLabelData = function () {
@@ -22,5 +24,5 @@ export const useLabelData = function () {
export const useLabelStore = function (i18n?: Composer) {
const api = useUserApi(i18n);
return useStore<MultiPurposeLabelOut>("label", store, loading, api.multiPurposeLabels);
return useStore<MultiPurposeLabelOut>("label", store, loading, initialized, api.multiPurposeLabels);
};