bugfix(BIL01, BIL-02)
Some checks are pending
Deploy Nyla Frontend to Integration / build-and-deploy (push) Waiting to run
Some checks are pending
Deploy Nyla Frontend to Integration / build-and-deploy (push) Waiting to run
This commit is contained in:
parent
5dd4741a0f
commit
ec4592c056
2 changed files with 23 additions and 4 deletions
|
|
@ -531,6 +531,10 @@ export function FormGeneratorTable<T extends Record<string, any>>({
|
||||||
|
|
||||||
// Debounce search term for backend calls
|
// Debounce search term for backend calls
|
||||||
const [debouncedSearchTerm, setDebouncedSearchTerm] = useState(searchTerm);
|
const [debouncedSearchTerm, setDebouncedSearchTerm] = useState(searchTerm);
|
||||||
|
|
||||||
|
// Bumped by the refresh button so the backend-refetch useEffect re-runs even
|
||||||
|
// when no other state (page/filters/sort/search) changed.
|
||||||
|
const [refreshNonce, setRefreshNonce] = useState(0);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
|
|
@ -608,7 +612,7 @@ export function FormGeneratorTable<T extends Record<string, any>>({
|
||||||
console.error('❌ FormGeneratorTable: Backend refetch failed:', error);
|
console.error('❌ FormGeneratorTable: Backend refetch failed:', error);
|
||||||
});
|
});
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [debouncedSearchTerm, filters, sortConfigs, currentPage, currentPageSize, supportsBackendPagination]);
|
}, [debouncedSearchTerm, filters, sortConfigs, currentPage, currentPageSize, supportsBackendPagination, refreshNonce]);
|
||||||
|
|
||||||
// Refs for action buttons containers to detect clicks outside
|
// Refs for action buttons containers to detect clicks outside
|
||||||
const actionButtonsRefs = useRef<Map<number, HTMLDivElement>>(new Map());
|
const actionButtonsRefs = useRef<Map<number, HTMLDivElement>>(new Map());
|
||||||
|
|
@ -1920,7 +1924,22 @@ export function FormGeneratorTable<T extends Record<string, any>>({
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}) : undefined}
|
}) : undefined}
|
||||||
onRefresh={onRefresh}
|
onRefresh={
|
||||||
|
// The refresh button resets pagination to page 1, clears any
|
||||||
|
// optimistic hidden-rows state, and bumps `refreshNonce` so the
|
||||||
|
// backend-refetch useEffect re-runs (even when no state changed).
|
||||||
|
// When the table supports backend pagination, the external
|
||||||
|
// onRefresh is skipped to avoid a double-fetch — the useEffect
|
||||||
|
// already calls hookData.refetch with the correct pagination.
|
||||||
|
onRefresh
|
||||||
|
? () => {
|
||||||
|
if (optimisticallyDeletedIds.size > 0) setOptimisticallyDeletedIds(new Set());
|
||||||
|
setCurrentPage(1);
|
||||||
|
setRefreshNonce(n => n + 1);
|
||||||
|
if (!supportsBackendPagination) onRefresh();
|
||||||
|
}
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
searchable={searchable}
|
searchable={searchable}
|
||||||
selectable={selectable}
|
selectable={selectable}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
|
|
|
||||||
|
|
@ -475,7 +475,7 @@ export const BillingDataView: React.FC = () => {
|
||||||
{ key: 'aicoreProvider', label: t('Anbieter'), type: 'text' as any, sortable: true, filterable: true, width: 120 },
|
{ key: 'aicoreProvider', label: t('Anbieter'), type: 'text' as any, sortable: true, filterable: true, width: 120 },
|
||||||
{ key: 'aicoreModel', label: t('Modell'), type: 'text' as any, sortable: true, filterable: true, width: 150 },
|
{ key: 'aicoreModel', label: t('Modell'), type: 'text' as any, sortable: true, filterable: true, width: 150 },
|
||||||
{ key: 'featureCode', label: t('Feature'), type: 'text' as any, sortable: true, filterable: true, width: 120 },
|
{ key: 'featureCode', label: t('Feature'), type: 'text' as any, sortable: true, filterable: true, width: 120 },
|
||||||
{ key: 'amount', label: t('Betrag (CHF)'), type: 'number' as any, sortable: true, width: 120 },
|
{ key: 'amount', label: t('Betrag (CHF)'), type: 'number' as any, sortable: true, searchable: true, width: 120 },
|
||||||
], [t]);
|
], [t]);
|
||||||
|
|
||||||
const totalBalance = useMemo(() => {
|
const totalBalance = useMemo(() => {
|
||||||
|
|
@ -609,7 +609,7 @@ export const BillingDataView: React.FC = () => {
|
||||||
fontWeight: chartMode === 'pie' ? 600 : 400,
|
fontWeight: chartMode === 'pie' ? 600 : 400,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('Pie')}
|
{t('Kreis')}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
onClick={() => setChartMode('bar')}
|
onClick={() => setChartMode('bar')}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue