Autodesk / Autodesk/react-base-table

Invalid ref in NextJS

Đang mở
#387 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
1.5k
Fork
170
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu với ví dụ Inline Editing trên trang tài liệu và triển khai EditableCell tùy chỉnh, tập trung vào cách ref của nó được truyền vào và thời điểm targetRef khả dụng. Tái tạo ví dụ trong môi trường NextJS, sau đó xác minh rằng các mục trong ô có thể được chỉnh sửa một cách đáng tin cậy mà ref không bị null trong lần render ban đầu.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
next.js, react, typescript
Lĩnh vực
frontend
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.