teableio/teable

View on GitHub
apps/nextjs-app/src/features/app/blocks/table/hooks/use-row-count-query.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { Table } from '@teable/sdk/model';
import { useEffect, useState } from 'react';

export const useRowCountQuery = (tableId: string, viewId: string) => {
  const [rowCount, setRowCount] = useState<number>();

  useEffect(() => {
    Table.getRowCount(tableId, { viewId }).then((res) => {
      setRowCount(res.data?.rowCount);
    });
  }, [tableId, viewId]);

  return rowCount;
};