Autodesk / Autodesk/react-base-table

Invalid ref in NextJS

オープン
#387 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
1.5k
フォーク
170
PR マージ指標
30日以内にマージされた PR はありません

説明

Is there a way to pass the ref to custom cell renders in NextJS environment?

The [Inline Editing](https://autodesk.github.io/react-base-table/examples/inline-editing) example in the documentation website doesn't work in NextJS because the ref provided to `EditableCell` is always null. I have tried various workarounds like loading the component dynamically and then using React.ForwardRef ([link](https://github.com/vercel/next.js/issues/4957)) but nothing seems to work. Even tried disabling SSR explicitly. The ref passed in is only valid after the first render cycle and it seems in the `EditableCell` class it tries to render with a null ref. You have some code protecting against this situation: `{editing && this.targetRef && (` but I'm wondering if there is a nicer or cleaner way to do this? I'm mainly looking for a way to edit the cell items.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

ドキュメントサイトの Inline Editing の例とカスタム EditableCell 実装から始め、ref がどのように渡されるか、また targetRef がいつ利用可能になるかに注目してください。NextJS 環境で例を再現し、その後、初回のレンダリング中に ref が null にならず、セル項目を確実に編集できることを確認してください。

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

評価

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

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

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