jbetancur / react-data-table-component

A responsive table library with built-in sorting, pagination, selection, expandable rows, and customizable styling.
https://react-data-table-component.netlify.app
Apache License 2.0
2.03k stars 409 forks source link

Getting mt is not a function error after v7.6.1 release #1200

Open YogiDhingani27 opened 7 months ago

YogiDhingani27 commented 7 months ago

I'm using version ^5.7.3 previously, and after 7.6.1 latest release, i encountered a mt is not a function error in our production environment.

image

Package version:

before

Changed the package version to fix the error:

after

Here is the component code of our component:

` import React from 'react'; import DataTable, { IDataTableProps, TableStyles } from 'react-data-table-component'; import CheckboxComp from '../Checkbox'; import CircularLoader from '../CircularLoader'; import { styledComponent, StyledNoDataComponent } from './DataTable.styled';

interface DataTableType extends IDataTableProps { dataEnable?: boolean; entityName?: string; fixedHeader?: boolean; fixedHeaderScrollHeight?: string; customStyleOveride?: Partial; columns?: any; data?: any; selectableRows?: boolean; selectableRowsNoSelectAll?: boolean; loaderHeight?: string; defaultSortFieldName?: string; defaultSortDirection?: string; sortingFunction: Function; noDataMesg: string; onSelectedRowsChange?: (selected: { allSelected: boolean; selectedCount: number; selectedRows: any[] }) => void; }

const NoDataComponent = mesg => {mesg};

const DataTables = ({ columns, data, selectableRows, selectableRowsComponent = CheckboxComp, onSelectedRowsChange, selectableRowSelected, fixedHeader = false, fixedHeaderScrollHeight = '100%', customStyleOveride = {}, progressPending, selectableRowsNoSelectAll = false, noDataComponent = NoDataComponent, loaderHeight, defaultSortFieldName, defaultSortDirection, sortingFunction, noDataMesg, }: DataTableType): JSX.Element => { return ( <DataTable columns={columns} data={data} defaultSortAsc={false} customStyles={{ ...styledComponent, ...customStyleOveride }} selectableRows={selectableRows} selectableRowsComponent={selectableRowsComponent} onSelectedRowsChange={onSelectedRowsChange} selectableRowSelected={selectableRowSelected} fixedHeaderScrollHeight={fixedHeaderScrollHeight} progressComponent={} noDataComponent={noDataComponent(noDataMesg)} progressPending={progressPending} selectableRowsNoSelectAll={selectableRowsNoSelectAll} onSort={sortingFunction} sortServer persistTableHead

); };

export default DataTables; ` This issue is resolved by removing the ^ sign from package version (by installing package with 5.7.3 version)

I don't know for which prop or change this error is coming i just resolved it by changing the package version.

If you're taking such changes in new release then you have to mention these breaking changes into the release docs.

jbetancur commented 7 months ago

please try 7.6.2