Skip to content

Comments

Multiple renames for clarity and consistency#3967

Open
nstepien wants to merge 10 commits intomainfrom
clarity
Open

Multiple renames for clarity and consistency#3967
nstepien wants to merge 10 commits intomainfrom
clarity

Conversation

@nstepien
Copy link
Collaborator

@nstepien nstepien commented Feb 21, 2026

I've renamed a few components/type for clarity and consistency.

  • Removed "formatter" from names, it's legacy nomenclature
  • Removed "renderer" from some names, virtually all React components are "renderers" so it's redundant.
    It's like naming components *Component.
  • To help differentiate between the renderers.renderCell and column.renderCell,
    I've changed some names from *CellProps to *CellContentProps for example
  • Removed some default exports so we use the same named import everywhere

Breaking changes:

  • cell content:
    • RenderCellProps -> RenderCellContentProps
    • RenderHeaderCellProps -> RenderHeaderCellContentProps
    • RenderSummaryCellProps -> RenderSummaryCellContentProps
    • RenderGroupCellProps -> RenderGroupCellContentProps
    • RenderEditCellProps -> RenderEditCellContentProps
  • CellRendererProps -> RenderCellProps
    • while this is consistent with everything else now (Render*Props pattern), it'll conflict with the older RenderCellProps type name, need to be careful when updating RDG
  • SelectCellFormatter -> SelectCheckbox

@codecov-commenter
Copy link

codecov-commenter commented Feb 21, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.53%. Comparing base (dd8eb88) to head (453e458).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3967      +/-   ##
==========================================
- Coverage   97.53%   97.53%   -0.01%     
==========================================
  Files          36       36              
  Lines        1463     1462       -1     
  Branches      472      472              
==========================================
- Hits         1427     1426       -1     
  Misses         36       36              
Files with missing lines Coverage Δ
src/Cell.tsx 100.00% <100.00%> (ø)
src/Columns.tsx 100.00% <100.00%> (ø)
src/DataGrid.tsx 98.98% <100.00%> (+<0.01%) ⬆️
src/EditCell.tsx 88.09% <ø> (ø)
src/GroupedRow.tsx 100.00% <ø> (ø)
src/Row.tsx 100.00% <100.00%> (ø)
src/SummaryCell.tsx 100.00% <ø> (ø)
src/TreeDataGrid.tsx 94.41% <100.00%> (+0.03%) ⬆️
src/cellRenderers/SelectCheckbox.tsx 100.00% <100.00%> (ø)
src/cellRenderers/renderToggleGroup.tsx 100.00% <ø> (ø)
... and 5 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nstepien nstepien self-assigned this Feb 23, 2026
function groupRows(
rows: readonly R[],
[groupByKey, ...remainingGroupByKeys]: readonly string[],
groupByIndex: number,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored this so we don't create temp arrays

fn: Maybe<(...args: Args) => void>
): Maybe<(...args: Args) => void>;

export function useLatestFunc<Args extends unknown[]>(fn: Maybe<(...args: Args) => void>) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can implement this without any/@ts-expect-error!

Object.setPrototypeOf(cellEvent, Object.getPrototypeOf(event));

return cellEvent;
});
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This creates a new object that inherits from the event object, and adds preventGridDefault/isGridDefaultPrevented property descriptors

WDYT?

*/
const handleColumnResizeLatest = useLatestFunc(handleColumnResize);
const handleColumnResizeEndLatest = useLatestFunc(handleColumnResizeEnd);
const onColumnsReorderLastest = useLatestFunc(onColumnsReorder);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Lastest" 🙈

const columnWidth = getColumnWidth(column);
const colSpan = column.colSpan?.({ type: 'ROW', row: rows[rowIdx] }) ?? 1;
const { insetInlineStart, ...style } = getCellStyle(column, colSpan);
const style = getCellStyle(column, colSpan);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-1 object

@nstepien nstepien marked this pull request as ready for review February 23, 2026 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants