nodeRef solution for React 19 does not work due to incorrect build output

オープン
#779 コメント 1 件 リアクション 3 件 担当者 0 名 GitHub で見る

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

評価

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

調査の方向性

Start with lib/DraggableCore.js at the nodeRef check and compare its behavior with the compiled output shown in the issue. Run or review the linked main.spec.ts tests to reproduce the empty-ref case. Done means the built package preserves the intended nodeRef behavior and the React 19 scenario no longer falls back to findDOMNode.

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

説明

The recommended solution for the React 19 findDOMNode removal is to provide a DOM element reference via nodeRef. This does not work due to how react-draggable is being built.

The check being done for provided nodeRef here falls back to using ReactDOM.findDOMNode when nodeRef is an empty ref ({ current: null }), which is always the initial value for DOM refs.

The source code appears to be doing the correct thing and should not result in this behavior, but the compiled code changes the behavior:

findDOMNode() {
  var _this$props$nodeRef$c, _this$props;
  return (_this$props$nodeRef$c = (_this$props = this.props) === null || _this$props === void 0 || (_this$props = _this$props.nodeRef) === null || _this$props === void 0 ? void 0 : _this$props.current) !== null && _this$props$nodeRef$c !== void 0 ? _this$props$nodeRef$c : _reactDom.default.findDOMNode(this);
}

I have some tests proving this here.

Image

主要言語
JavaScript
スター
9.3k
フォーク
1k
平均マージ
3日 8時間
マージ済み PR(30日)
4

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

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

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

react-grid-layout/react-draggable のほかの issue

react-grid-layout/react-draggable の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

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

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