react-component / react-component/table

The problem of render return value in the columns configuration of the table

Open
#396 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.4k
Forks
618
Avg merge
10h 19m
Merged PRs (30d)
2

Description

During the use of the latest version, I found that if the return value of the render function is an array, it will not render.
I checked the code:

// Not crash if final `childNode` is not validate ReactNode
if (typeof childNode === 'object' && !React.isValidElement(childNode)) {
  childNode = null;
}

This code will fail to render. Do you have plans to modify the code like this to support returning array or is it no longer supported to return array?

if (Array.isArray(childNode)) {
  childNode = childNode.filter((o) => React.isValidElement(o));
}

// Not crash if final `childNode` is not validate ReactNode
if (typeof childNode === 'object' && !Array.isArray(childNode) && !React.isValidElement(childNode)) {
  childNode = null;
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the render-value handling shown in the issue and reproduce a columns configuration whose render function returns an array. Check the resulting table output and existing validation behavior; done means valid React elements returned in arrays render without allowing invalid values to crash the table.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.