fix(home): correct pagination property and type annotations
Some checks failed
CI / style (push) Has been cancelled
CI / build-client (push) Has been cancelled
CI / build-amd64 (push) Has been cancelled
CI / build-tester (push) Has been cancelled
CI / test (cockroachdb) (push) Has been cancelled
CI / test (mariadb) (push) Has been cancelled
CI / test (postgres) (push) Has been cancelled
CI / test (sqlite) (push) Has been cancelled
CI / build-arm64 (push) Has been cancelled
CI / build-armv7 (push) Has been cancelled
CI / publish-images (push) Has been cancelled
CI / publish-release (push) Has been cancelled
Some checks failed
CI / style (push) Has been cancelled
CI / build-client (push) Has been cancelled
CI / build-amd64 (push) Has been cancelled
CI / build-tester (push) Has been cancelled
CI / test (cockroachdb) (push) Has been cancelled
CI / test (mariadb) (push) Has been cancelled
CI / test (postgres) (push) Has been cancelled
CI / test (sqlite) (push) Has been cancelled
CI / build-arm64 (push) Has been cancelled
CI / build-armv7 (push) Has been cancelled
CI / publish-images (push) Has been cancelled
CI / publish-release (push) Has been cancelled
- Use 'currentPage' instead of 'current' for pagination - Remove explicit ISpool type on filter callback (inferred) - Add type assertion for Table dataSource Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -33,7 +33,7 @@ export const Home: React.FC<IResourceComponentsProps> = () => {
|
|||||||
// Fetch all spools (not archived) for the main list
|
// Fetch all spools (not archived) for the main list
|
||||||
const { result: spoolsResult, query: spoolsQuery } = useList<ISpool>({
|
const { result: spoolsResult, query: spoolsQuery } = useList<ISpool>({
|
||||||
resource: "spool",
|
resource: "spool",
|
||||||
pagination: { current: currentPage, pageSize },
|
pagination: { currentPage, pageSize },
|
||||||
sorters: [{ field: "last_used", order: "desc" }],
|
sorters: [{ field: "last_used", order: "desc" }],
|
||||||
meta: {
|
meta: {
|
||||||
queryParams: {
|
queryParams: {
|
||||||
@@ -54,9 +54,9 @@ export const Home: React.FC<IResourceComponentsProps> = () => {
|
|||||||
|
|
||||||
// Calculate low stock spools
|
// Calculate low stock spools
|
||||||
const lowStockCount = useMemo(() => {
|
const lowStockCount = useMemo(() => {
|
||||||
if (!spoolsResult?.data) return 0;
|
const data = spoolsResult?.data || [];
|
||||||
return spoolsResult.data.filter(
|
return data.filter(
|
||||||
(spool: ISpool) => spool.remaining_weight !== undefined && spool.remaining_weight < LOW_STOCK_THRESHOLD
|
(spool) => spool.remaining_weight !== undefined && spool.remaining_weight < LOW_STOCK_THRESHOLD
|
||||||
).length;
|
).length;
|
||||||
}, [spoolsResult?.data]);
|
}, [spoolsResult?.data]);
|
||||||
|
|
||||||
@@ -191,8 +191,8 @@ export const Home: React.FC<IResourceComponentsProps> = () => {
|
|||||||
extra={<Link to="/spool">{t("buttons.viewAll")}</Link>}
|
extra={<Link to="/spool">{t("buttons.viewAll")}</Link>}
|
||||||
styles={{ body: { padding: 0 } }}
|
styles={{ body: { padding: 0 } }}
|
||||||
>
|
>
|
||||||
<Table
|
<Table<ISpool>
|
||||||
dataSource={spoolsResult?.data}
|
dataSource={spoolsResult?.data as ISpool[]}
|
||||||
columns={spoolColumns}
|
columns={spoolColumns}
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
loading={spoolsQuery.isLoading}
|
loading={spoolsQuery.isLoading}
|
||||||
|
|||||||
Reference in New Issue
Block a user