question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[RFC] Deprecated Table columns.render return cell props and use `onCell` instead

See original GitHub issue

📋 RFC

Summary

Use onCell instead of render return cell.props.

Basic example

    const columns = [{
      dataIndex: 'name',
--    render: (val) => ({
--      props: { colSpan: 2 },
--      children: val,
--    });
++    onCell: (record) => ({ colSpan: 2 });
    }];

Motivation

As #32979 mentioned. Table column mix props & node in one render function which cost additional perf calculation. And this will also makes row hover calculation no way to optimize. Since we already have onCell function and this is same logic as render.props, it’s reasonable to de-duplicate.

Detailed

To make this RFC done:

  1. We need patch warning info in rc-table and suggest user move to onCell. Also keep origin span logic do not modified.
  2. Move hover logic to onCell base which will speed up render perf

Drawbacks

No break of current usage. But get warning.

Adoption strategy

When finished dev will replace all demo to new usage.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
chillyistkultcommented, Feb 22, 2022

How to get value as parameter of onCell? As I understand only record is passed in onCell, for what would we need dataIndex then?

Seems like deprecating render while not fully support an alternative is not the best approach.

I am asking this because table performance is still horrible, because of the hover issue.

1reaction
VahanBeckcommented, Apr 15, 2022

How to get value as parameter of onCell? As I understand only record is passed in onCell, for what would we need dataIndex then?

Seems like deprecating render while not fully support an alternative is not the best approach.

I am asking this because table performance is still horrible, because of the hover issue.

Exactly! The value property is very useful, so i don’t think we will migrate to onCell until you have a suitable substitute to render

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot get Ant design Table cell to have reference to dynamic ...
I made some changes to your code and managed to achieve logging the correct number of columns on the button click for a...
Read more >
Table - Ant Design
A table displays rows of data. When To Use. To display a collection of structured data. To sort, search, paginate, filter data. How...
Read more >
Column onCell 'GetComponentProps<unknown>' error #22451
When trying to render a record onto a Column using the onCell method, this typescript error is encountered: Type '(record: unknown) => {...
Read more >
show message validate error input once at a time ant design ...
Added column[onCell] to allow passing custom props to table body cell. ... Deprecate getBodyWrapper , please use components instead。
Read more >
Apache HBase ™ Reference Guide
We will show you how to create a table in HBase using the hbase shell CLI, ... hbase(main):006:0> scan 'test' ROW COLUMN+CELL row1...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found