This commit is contained in:
seb
2026-10-11 03:37:06 +02:00
parent 45cc69730b
commit 5e8037d430
4 changed files with 121 additions and 86 deletions

View File

@@ -177,15 +177,12 @@ class ArtikelLagerPage extends PureComponent {
setLastArticleSku(null);
this._cancelled = false;
this.unsub = warehouseAutomat.subscribe(this, (state) => {
if (this._cancelled) return;
return {
warehouses: state.filteredWarehouses,
filter: state.filter,
status: state.status,
error: state.error ? backendErrorFrom(state.error) : null,
};
});
this.unsub = warehouseAutomat.subscribe(this, (state) => ({
warehouses: state.filteredWarehouses ?? state.warehouses,
filter: state.filter ?? '',
status: state.status,
error: state.error ? backendErrorFrom(state.error) : null,
}));
if (warehouseAutomat.state.status !== 'ready') {
void warehouseAutomat.actions.load().catch((err) => notifyError(err));
@@ -265,7 +262,7 @@ class ArtikelLagerPage extends PureComponent {
}
render() {
const { status, error, warehouses } = this.state;
const { status, error, warehouses, filter } = this.state;
const { prefill, returnTo } = getInitialParams(this.props);
if (status === 'loading' || status === 'idle') {
@@ -280,6 +277,8 @@ class ArtikelLagerPage extends PureComponent {
return <BackendError error={error} onRetry={this.handleRetry} />;
}
const trimmedFilter = filter?.trim() ?? '';
return (
<>
<ArtikelLagerSearchField
@@ -293,7 +292,9 @@ class ArtikelLagerPage extends PureComponent {
<List dense disablePadding ref={this.listRef} sx={{ width: '100%' }}>
{warehouses.length === 0 ? (
<Typography variant="body2" color="text.secondary" sx={{ py: 1 }}>
Noch keine Lager angelegt.
{trimmedFilter
? `Keine Treffer für „${trimmedFilter}“.`
: 'Noch keine Lager angelegt.'}
</Typography>
) : (
warehouses.map((wh) => (