Add inactive item fallback for dashboard change feed lookups
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2026-04-12 22:46:28 +02:00
parent 79f4138b95
commit 6ca09cdf1f
4 changed files with 98 additions and 4 deletions
+5 -2
View File
@@ -116,8 +116,11 @@ export async function listGroupedStockEntries(store, options = {}) {
return fetchAllListPages(store, `${getPath('items')}/grouped`, baseQuery);
}
export async function getStockEntry(store, stockId) {
const payload = await apiRequest(store, `${getPath('items')}/${stockId}`);
export async function getStockEntry(store, stockId, { allowInactive = false } = {}) {
const path = `${getPath('items')}/${stockId}`;
const payload = allowInactive
? await apiRequest(store, path, { query: { allow_inactive: 1 } })
: await apiRequest(store, path);
return unwrapEntryPayload(payload);
}
+12 -1
View File
@@ -165,7 +165,18 @@ export function dashboardPageData(store) {
if (missingItemUuids.length) {
const results = await Promise.allSettled(
missingItemUuids.map((uuid) => getStockEntry(store, uuid)),
missingItemUuids.map(async (uuid) => {
try {
return await getStockEntry(store, uuid);
} catch (error) {
const status = error?.status || error?.cause?.status;
if (status !== 404) {
throw error;
}
return getStockEntry(store, uuid, { allowInactive: true });
}
}),
);
results.forEach((result) => {