Skip to content

Commit

Permalink
remove unnecessary memo
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinVandy committed Sep 16, 2022
1 parent 938a9d1 commit 559f017
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,5 +1,5 @@
{
"version": "1.0.6",
"version": "1.0.7",
"license": "MIT",
"name": "material-react-table",
"description": "A fully featured Material UI V5 implementation of TanStack React Table V8, written from the ground up in TypeScript.",
Expand Down
26 changes: 26 additions & 0 deletions src/MaterialReactTable.tsx
Expand Up @@ -50,6 +50,10 @@ import { MRT_SortingFns } from './sortingFns';
import { MRT_TableRoot } from './table/MRT_TableRoot';
import { MRT_DefaultColumn, MRT_DefaultDisplayColumn } from './column.utils';

/**
* Most of this file is just TypeScript types
*/

type DensityState = 'comfortable' | 'compact' | 'spacious';

type LiteralUnion<T extends U, U = string> = T | (U & Record<never, never>);
Expand Down Expand Up @@ -602,9 +606,31 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
| 'state'
> & {
columnFilterModeOptions?: (MRT_FilterOption | string)[] | null;
/**
* The columns to display in the table. `accessorKey`s or `accessorFn`s must match keys in the `data` prop.
*
* See more info on creating columns on the official docs site:
* @link https://www.material-react-table.com/docs/guides/data-columns
* @link https://www.material-react-table.com/docs/guides/display-columns
*
* See all Columns Options on the official docs site:
* @link https://www.material-react-table.com/docs/api/column-options
*/
columns: MRT_ColumnDef<TData>[];
/**
* Pass your data as an array of objects. Objects can theoretically be any shape, but it's best to keep them consistent.
*
* See the usage guide for more info on creating columns and data:
* @link https://www.material-react-table.com/docs/getting-started/usage
*/
data: TData[];
/**
* Instead of specifying a bunch of the same options for each column, you can just change an option in the `defaultColumn` prop to change a default option for all columns.
*/
defaultColumn?: Partial<MRT_ColumnDef<TData>>;
/**
* Change the default options for display columns.
*/
defaultDisplayColumn?: Partial<MRT_ColumnDef<TData>>;
displayColumnDefOptions?: Partial<{
[key in MRT_DisplayColumnIds]: Partial<MRT_ColumnDef>;
Expand Down
9 changes: 2 additions & 7 deletions src/body/MRT_TableBodyCellValue.tsx
@@ -1,12 +1,12 @@
import React, { FC, memo } from 'react';
import React, { FC } from 'react';
import { MRT_Cell, MRT_TableInstance } from '..';

interface Props {
cell: MRT_Cell;
table: MRT_TableInstance;
}

const _MRT_TableBodyCellValue: FC<Props> = ({ cell, table }) => {
export const MRT_TableBodyCellValue: FC<Props> = ({ cell, table }) => {
const { column, row } = cell;
const { columnDef } = column;

Expand All @@ -32,8 +32,3 @@ const _MRT_TableBodyCellValue: FC<Props> = ({ cell, table }) => {
</>
);
};

export const MRT_TableBodyCellValue = memo(
_MRT_TableBodyCellValue,
(prev, next) => prev.cell.getValue() === next.cell.getValue(),
);

0 comments on commit 559f017

Please sign in to comment.