react-component / react-component/tree

Flat data for the tree

Open
#303 3 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.3k
Forks
490
Avg merge
3d 17h
Merged PRs (30d)
5

Description

I want to have flat list of objects, more like a relational database, rather than real tree. But it has all the info for the tree:

const treeDataList = [
  {
    key: '0-0',
    title: 'parent 1',
    children: ['0-0-0', '0-0-1'],
  },
  {
    key: '0-0-0',
    title: 'parent 1-1',
    children: ['0-0-0-0'],
  },
  { key: '0-0-0-0', title: 'parent 1-1-0' },
  {
    key: '0-0-1',
    title: 'parent 1-2',
    children: [
      '0-0-1-0',
      '0-0-1-1',
      '0-0-1-2',
      '0-0-1-3',
      '0-0-1-4',
      '0-0-1-5',
      '0-0-1-6',
      '0-0-1-7',
      '0-0-1-8',
      '0-0-1-9',
    ],
  },
  { key: '0-0-1-0', title: 'parent 1-2-0' },
  { key: '0-0-1-1', title: 'parent 1-2-1' },
  { key: '0-0-1-2', title: 'parent 1-2-2' },
  { key: '0-0-1-3', title: 'parent 1-2-3' },
  { key: '0-0-1-4', title: 'parent 1-2-4' },
  { key: '0-0-1-5', title: 'parent 1-2-5' },
  { key: '0-0-1-6', title: 'parent 1-2-6' },
  { key: '0-0-1-7', title: 'parent 1-2-7' },
  { key: '0-0-1-8', title: 'parent 1-2-8' },
  { key: '0-0-1-9', title: 'parent 1-2-9' },
]

Does rc-tree support such a flat shape? Ofc, I may make some additional layer myself, so original data will stay flat, but for the tree I'll have this additional layer which will be actual tree. But I'm wondering if it's already supported, because, well... It looks like a pretty much common case.

If it's not supported, what do you think about this idea?

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 by reviewing rc-tree's current data-shape API and usage examples to determine whether a flat list is accepted directly. Define the expected flat-data behavior and conversion boundaries, then document or test the conclusion; the issue is done when supported input or a clear implementation proposal is established.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.