diff --git a/prettier.config.js b/prettier.config.js index 0614ee7..c432050 100644 --- a/prettier.config.js +++ b/prettier.config.js @@ -1,6 +1,12 @@ module.exports = { - trailingComma: 'es5', + printWidth: 80, tabWidth: 2, + useTabs: false, semi: false, singleQuote: true, + trailingComma: 'es5', + bracketSpacing: true, + jsxBracketSameLine: false, + arrowParens: 'avoid', + endOfLine: 'auto', } diff --git a/src/hooks/useTable.js b/src/hooks/useTable.js index e8e5433..028d064 100755 --- a/src/hooks/useTable.js +++ b/src/hooks/useTable.js @@ -12,7 +12,6 @@ import { } from '../utils' import { useTableState } from './useTableState' -import { useRows } from './useRows' const propTypes = { // General @@ -39,7 +38,6 @@ export const useTable = (props, ...plugins) => { let { data, state: userState, - useRows: userUseRows = useRows, columns: userColumns, defaultColumn = {}, subRowsKey = 'subRows', @@ -80,9 +78,7 @@ export const useTable = (props, ...plugins) => { if (debug) console.time('hooks') // Loop through plugins to build the api out - api = [userUseRows, ...plugins] - .filter(Boolean) - .reduce((prev, next) => next(prev), api) + api = plugins.filter(Boolean).reduce((prev, next) => next(prev), api) if (debug) console.timeEnd('hooks') // Compute columns, headerGroups and headers diff --git a/src/plugin-hooks/useGroupBy.js b/src/plugin-hooks/useGroupBy.js index 4e89d8f..6360a15 100755 --- a/src/plugin-hooks/useGroupBy.js +++ b/src/plugin-hooks/useGroupBy.js @@ -1,3 +1,4 @@ +import React from 'react' import { useMemo } from 'react' import PropTypes from 'prop-types' @@ -48,10 +49,14 @@ export const useGroupBy = props => { // Sort grouped columns to the start of the column list // before the headers are built hooks.columnsBeforeHeaderGroups.push(columns => { - return [ - ...groupBy.map(g => columns.find(col => col.id === g)), - ...columns.filter(col => !groupBy.includes(col.id)), - ] + // eslint-disable-next-line react-hooks/rules-of-hooks + return React.useMemo( + () => [ + ...groupBy.map(g => columns.find(col => col.id === g)), + ...columns.filter(col => !groupBy.includes(col.id)), + ], + [columns] + ) }) columns.forEach(column => {