Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

custom Data within expanding example Crashing browser

オープン
#5,162 コメント 7 件 リアクション 2 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
react, typescript
領域
frontend

調査の方向性

リンクされたCodeSandboxを実行し、動作するuseStateバージョンと、カスタムデータをuseReactTableに直接渡しているバージョンを比較します。まずデータの形状、getSubRows、expandingの例の設定から確認します。カスタムのネストされたデータでブラウザがクラッシュしなくなり、expandingテーブルの動作が引き続き利用できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Describe the bug

Hi,
I've taken this example: https://tanstack.com/table/v8/docs/examples/react/expanding
Removed things like the search filter and some extra debug but beside that I didn't change how expanding works.
For testing purposes I went and made my own data. A simple json and to be as close to the example as possible I print out data and put that in its own object and removed the useState data and I'm just passing the object with its subRows directly to useReactTable. When doing that the browser will crash. I'm brand new to TanStack and may not be understanding how subRows works but I feel like this shouldn't be crashing when I pass it the object when all it takes is any[](Ideally this should thrown an error but not sure where it's getting stuck in almost a loop, this is an assumption).
This however, does not crash if I pass the object to the useState(initialize).

Here is the sandbox

To be more specific, in the sandbox I have where it works and where it doesn't. To highlight where it doesn't:

const data = [
  {
    "firstName": "Daryl",
    "lastName": "Rutherford",
    "age": 15,
    "visits": 945,
    "progress": 46,
    "status": "single",
    "subRows": [
        {
            "firstName": "Kobe",
            "lastName": "Lakin",
            "age": 20,
            "visits": 308,
            "progress": 19,
            "status": "single",
            "subRows": [
                {
                    "firstName": "Edyth",
                    "lastName": "Klocko",
                    "age": 38,
                    "visits": 362,
                    "progress": 29,
                    "status": "single"
                },
                {
                    "firstName": "Alayna",
                    "lastName": "Stroman",
                    "age": 11,
                    "visits": 120,
                    "progress": 25,
                    "status": "single"
                },
                {
                    "firstName": "Carolyn",
                    "lastName": "Rowe-Hammes",
                    "age": 14,
                    "visits": 14,
                    "progress": 77,
                    "status": "relationship"
                }
            ]
        },
        {
            "firstName": "Cassandre",
            "lastName": "Hudson",
            "age": 27,
            "visits": 488,
            "progress": 65,
            "status": "relationship",
            "subRows": [
                {
                    "firstName": "Cade",
                    "lastName": "Hartmann-Effertz",
                    "age": 22,
                    "visits": 901,
                    "progress": 93,
                    "status": "single"
                },
                {
                    "firstName": "Pietro",
                    "lastName": "Yost",
                    "age": 7,
                    "visits": 731,
                    "progress": 99,
                    "status": "complicated"
                },
                {
                    "firstName": "Payton",
                    "lastName": "Kessler",
                    "age": 26,
                    "visits": 851,
                    "progress": 83,
                    "status": "complicated"
                }
            ]
        },
        {
            "firstName": "Nels",
            "lastName": "Kunde",
            "age": 6,
            "visits": 307,
            "progress": 52,
            "status": "complicated",
            "subRows": [
                {
                    "firstName": "Nikki",
                    "lastName": "Hackett",
                    "age": 9,
                    "visits": 518,
                    "progress": 44,
                    "status": "single"
                },
                {
                    "firstName": "Cornell",
                    "lastName": "Gulgowski",
                    "age": 27,
                    "visits": 810,
                    "progress": 60,
                    "status": "complicated"
                },
                {
                    "firstName": "Jordan",
                    "lastName": "Bode",
                    "age": 26,
                    "visits": 15,
                    "progress": 93,
                    "status": "relationship"
                }
            ]
        },
        {
            "firstName": "Alberta",
            "lastName": "Heaney",
            "age": 20,
            "visits": 15,
            "progress": 57,
            "status": "complicated",
            "subRows": [
                {
                    "firstName": "Braxton",
                    "lastName": "Kuvalis",
                    "age": 11,
                    "visits": 366,
                    "progress": 93,
                    "status": "relationship"
                },
                {
                    "firstName": "Elyssa",
                    "lastName": "Rolfson",
                    "age": 30,
                    "visits": 144,
                    "progress": 39,
                    "status": "relationship"
                },
                {
                    "firstName": "Jennyfer",
                    "lastName": "Altenwerth",
                    "age": 28,
                    "visits": 200,
                    "progress": 30,
                    "status": "single"
                }
            ]
        },
        {
            "firstName": "Bertrand",
            "lastName": "Shields",
            "age": 40,
            "visits": 733,
            "progress": 20,
            "status": "complicated",
            "subRows": [
                {
                    "firstName": "Liliane",
                    "lastName": "Hudson",
                    "age": 38,
                    "visits": 649,
                    "progress": 85,
                    "status": "single"
                },
                {
                    "firstName": "Jevon",
                    "lastName": "Lemke",
                    "age": 32,
                    "visits": 5,
                    "progress": 89,
                    "status": "relationship"
                },
                {
                    "firstName": "Donavon",
                    "lastName": "Zemlak",
                    "age": 11,
                    "visits": 20,
                    "progress": 62,
                    "status": "complicated"
                }
            ]
        }
    ]
}
] 

const table = useReactTable({
    data,
    columns,
    state: {
      expanded,
    },
    onExpandedChange: setExpanded,
    getSubRows: row => row.subRows,
    getCoreRowModel: getCoreRowModel(),
    getPaginationRowModel: getPaginationRowModel(),
    getFilteredRowModel: getFilteredRowModel(),
    getExpandedRowModel: getExpandedRowModel(),
    debugTable: true,
  })

// etc .....


Your minimal, reproducible example

https://codesandbox.io/p/sandbox/confident-boyd-przwfd?layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522cloyw4otq000b356hisiifrwr%2522%252C%2522sizes%2522%253A%255B70%252C30%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522cloyw4otp0003356h0ybmt814%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522cloyw4otq0008356hc0hfqnik%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522cloyw4otq000a356hjk6r9kry%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B50%252C50%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522cloyw4otp0003356h0ybmt814%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522cloyw4otp0002356h7q2ak4ya%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252FREADME.md%2522%257D%255D%252C%2522id%2522%253A%2522cloyw4otp0003356h0ybmt814%2522%252C%2522activeTabId%2522%253A%2522cloyw4otp0002356h7q2ak4ya%2522%257D%252C%2522cloyw4otq000a356hjk6r9kry%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522cloyw4otq0009356hce6oqi2i%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_PORT%2522%252C%2522taskId%2522%253A%2522dev%2522%252C%2522port%2522%253A5176%252C%2522path%2522%253A%2522%252F%2522%257D%255D%252C%2522id%2522%253A%2522cloyw4otq000a356hjk6r9kry%2522%252C%2522activeTabId%2522%253A%2522cloyw4otq0009356hce6oqi2i%2522%257D%252C%2522cloyw4otq0008356hc0hfqnik%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522cloyw4otq0004356h9xu1efl9%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522dev%2522%257D%252C%257B%2522id%2522%253A%2522cloyw4otq0005356h28uf1vza%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522build%2522%257D%252C%257B%2522id%2522%253A%2522cloyw4otq0006356hn7bkxz9e%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522serve%2522%257D%252C%257B%2522id%2522%253A%2522cloyw4otq0007356hp0sbtyfs%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522start%2522%257D%255D%252C%2522id%2522%253A%2522cloyw4otq0008356hc0hfqnik%2522%252C%2522activeTabId%2522%253A%2522cloyw4otq0004356h9xu1efl9%2522%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Atrue%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D

Steps to reproduce
  1. Uncomment Line 302 - 483 and comment out 117-299
Expected behavior

I expect it to work because I'm still passing an array. But if this isn't correct then I'd expect an error.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

Linux & codesandbox

react-table version

8.10.7

TypeScript version

4.8.4

Additional context

No response

Terms & Code of Conduct
  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
主要言語
TypeScript
スター
28.5k
フォーク
3.6k
平均マージ
2日 3時間
マージ済み PR(30日)
3

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

TanStack/table のほかの issue

TanStack/table の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。