Refactor stock API to replace numeric flags with boolean values, add getItemLabel endpoint, and update tests/documentation
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -924,7 +924,7 @@ export function stockListPageData(store) {
|
||||
} else {
|
||||
initTasks.push(
|
||||
this.loadGroupedEntries({
|
||||
expanded: 0,
|
||||
expanded: false,
|
||||
resetVisible: !restoredContext,
|
||||
}),
|
||||
);
|
||||
@@ -1309,7 +1309,7 @@ export function stockListPageData(store) {
|
||||
|
||||
if (mode === 'grouped') {
|
||||
if (!this.groupedLoaded) {
|
||||
await this.loadGroupedEntries({ expanded: 0, resetVisible: true });
|
||||
await this.loadGroupedEntries({ expanded: false, resetVisible: true });
|
||||
}
|
||||
this.hydrateGroupedEntriesInBackground().catch(() => {});
|
||||
return;
|
||||
@@ -1325,7 +1325,7 @@ export function stockListPageData(store) {
|
||||
: this.itemsLoaded);
|
||||
|
||||
if (this.viewMode === 'grouped') {
|
||||
await this.loadGroupedEntries({ expanded: 0, background: useBackground });
|
||||
await this.loadGroupedEntries({ expanded: false, background: useBackground });
|
||||
this.hydrateGroupedEntriesInBackground({ force: true }).catch(() => {});
|
||||
return;
|
||||
}
|
||||
@@ -1417,7 +1417,7 @@ export function stockListPageData(store) {
|
||||
this.invalidateMemo();
|
||||
this.persistRuntimeCache();
|
||||
},
|
||||
async loadGroupedEntries({ expanded = 1, background = false, resetVisible = false } = {}) {
|
||||
async loadGroupedEntries({ expanded = true, background = false, resetVisible = false } = {}) {
|
||||
if (!store.isConnected) {
|
||||
return;
|
||||
}
|
||||
@@ -1432,7 +1432,7 @@ export function stockListPageData(store) {
|
||||
|
||||
try {
|
||||
const loadedGroups = await listGroupedStockEntries(store, { expanded });
|
||||
if (expanded === 0) {
|
||||
if (!expanded) {
|
||||
this.applyGroupedSummary(loadedGroups, { resetVisible });
|
||||
return;
|
||||
}
|
||||
@@ -1461,7 +1461,7 @@ export function stockListPageData(store) {
|
||||
|
||||
this.groupedHydrating = true;
|
||||
try {
|
||||
await this.loadGroupedEntries({ expanded: 1, background: true });
|
||||
await this.loadGroupedEntries({ expanded: true, background: true });
|
||||
} finally {
|
||||
this.groupedHydrating = false;
|
||||
}
|
||||
@@ -1473,7 +1473,7 @@ export function stockListPageData(store) {
|
||||
}
|
||||
if (this.groupedLoaded) {
|
||||
tasks.push(
|
||||
this.loadGroupedEntries({ expanded: 0, background: true }).then(() =>
|
||||
this.loadGroupedEntries({ expanded: false, background: true }).then(() =>
|
||||
this.hydrateGroupedEntriesInBackground({ force: true }),
|
||||
),
|
||||
);
|
||||
@@ -2269,7 +2269,7 @@ export function stockListPageData(store) {
|
||||
? `${item.name} was already out of stock and removed from the group.`
|
||||
: `${item.name} was ${actionLabel} and removed from the group.`,
|
||||
});
|
||||
this.loadGroupedEntries({ expanded: 0, background: true }).catch(() => {});
|
||||
this.loadGroupedEntries({ expanded: false, background: true }).catch(() => {});
|
||||
} catch (error) {
|
||||
this.editErrors[item.id] = error.message || 'Removal failed.';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user