fix: Misc Issues with Ingredient Parser (#6250)

This commit is contained in:
Michael Genson
2025-09-26 11:25:15 -05:00
committed by GitHub
parent f3cc51190c
commit 187e83eeb5
5 changed files with 58 additions and 27 deletions

View File

@@ -29,20 +29,24 @@ export function useReadOnlyActions<T extends BoundT>(
params.orderBy ??= "name";
params.orderDirection ??= "asc";
loading.value = true;
const allItems = useAsyncData(useAsyncKey(), async () => {
const { data } = await api.getAll(page, perPage, params);
loading.value = false;
loading.value = true;
try {
const { data } = await api.getAll(page, perPage, params);
if (data && allRef) {
allRef.value = data.items;
}
if (data && allRef) {
allRef.value = data.items;
}
if (data) {
return data.items ?? [];
if (data) {
return data.items ?? [];
}
else {
return [];
}
}
else {
return [];
finally {
loading.value = false;
}
});
@@ -84,20 +88,24 @@ export function useStoreActions<T extends BoundT>(
params.orderBy ??= "name";
params.orderDirection ??= "asc";
loading.value = true;
const allItems = useAsyncData(useAsyncKey(), async () => {
const { data } = await api.getAll(page, perPage, params);
loading.value = false;
loading.value = true;
try {
const { data } = await api.getAll(page, perPage, params);
if (data && allRef) {
allRef.value = data.items;
}
if (data && allRef) {
allRef.value = data.items;
}
if (data) {
return data.items ?? [];
if (data) {
return data.items ?? [];
}
else {
return [];
}
}
else {
return [];
finally {
loading.value = false;
}
});

View File

@@ -29,7 +29,7 @@ export const useReadOnlyStore = function <T extends BoundT>(
},
};
if (!loading.value && (!store.value || store.value.length === 0)) {
if (!loading.value && !store.value.length) {
const result = actions.getAll(1, -1, params);
store.value = result.value || [];
}
@@ -54,7 +54,7 @@ export const useStore = function <T extends BoundT>(
},
};
if (!loading.value && (!store.value || store.value.length === 0)) {
if (!loading.value && !store.value.length) {
const result = actions.getAll(1, -1, params);
store.value = result.value || [];
}