React_Usage_Check reports React 19's react-dom as inlined_react_dom (pre-19)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 75/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, php, react
Hướng nghiên cứu
Read find_inlined_pre_19_react() and the existing React usage check tests, especially the react-19.js fixture in test-plugin-react-usage-without-errors. Add coverage for a React 19 react-dom bundle containing both element symbol declarations and a __reactFiber$ key, then verify the check no longer reports inlined_react_dom for it.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Bug Description
React_Usage_Check (2.2.0, unchanged on trunk) reports inlined_react_dom for a bundle that inlines React 19's react-dom. A plugin that has already upgraded to React 19 gets an error telling it to stop bundling a pre-19 React.
The cause: React 19's DOM renderer still declares the React 18 element symbol. It keeps it only to detect elements made by an older React and throw a clear error. From [email protected]/cjs/react-dom-client.production.js, lines 279–280:
REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
The development build uses it for this message:
if (newChild.$$typeof === REACT_LEGACY_ELEMENT_TYPE)
// 'A React Element from an older version of React was rendered. This is not supported. ...'
find_inlined_pre_19_react() matches the react.element string literal, and the react-dom package only needs __reactFiber$, which React 19's renderer also contains. So any bundle with React 19's react-dom client is reported. The react-19.js fixture in test-plugin-react-usage-without-errors covers only the JSX runtime, so the tests don't catch it.
React 19's react and react/jsx-runtime are not affected: they declare only react.transitional.element.
Steps to reproduce
- Make a bundle with React 19:
with// src/index.js import { createRoot } from 'react-dom/client'; createRoot( document.getElementById( 'app' ) ).render( 'hello' );[email protected]and[email protected], built with any bundler (Vite, webpack or esbuild), without externalizing React. - Put the output in a plugin and run
wp plugin check <plugin>.
A smaller reproduction is to copy [email protected]/cjs/react-dom-client.production.js into a plugin as a .js file.
Expected behaviour
No inlined_react_dom error. The file holds React 19.
Actual behaviour
ERROR inlined_react_dom, positioned at the "react.element" literal.
Possible fix
Treat a file as React 19 when it holds React 19's marker, whatever legacy symbol it also declares. For example, in find_inlined_pre_19_react(), return false when ([\'"])react.transitional.element\1also matches. Another option is to skip only thereact-dompackage in that case. React 19's renderer also defines__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE`, which no earlier React has.
Either way, a react-dom-19.js fixture holding both symbol declarations and a __reactFiber$ key would cover it.
Environment
- Plugin Check 2.2.0 (WP-CLI,
--include-low-severity-errors --include-low-severity-warnings --include-experimental) - React / ReactDOM 19.3.1, bundled with Vite
As a workaround, our build rewrites that one literal to Symbol.for(["react", "element"].join(".")), which is the same registered symbol. We'll remove that once a release no longer reports React 19's renderer.
- Ngôn ngữ chính
- PHP
- Star
- 365
- Fork
- 135
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 20
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của WordPress/plugin-check
-
False positive trademarked_term warning for "wc" inside the word "Flowchart"Có thể đã có người làm @anandrajaram21 đã nhận 3 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
WordPress/plugin-check#1556 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add opt-in .distignore exclusions for local and CI scansCó thể đã có người làm @jakaria-istauk đã nhận 1 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
WordPress/plugin-check#1559 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 58/100
WordPress/plugin-check#1557 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
WordPress/plugin-check#1555 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
PHPErrorReportingSniff flags debug constants used as values in const declarationsCó thể đã có người làm @elphizu đã nhận 7 ngày trước. Đang mở
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 35/100
WordPress/plugin-check#1553 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của WordPress/plugin-check
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
ExpressionEngine/ExpressionEngine#5493 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
"Attempt to read property 'username' on null" error after a user is deletedCó thể đã có người làm @dicksonlaw583 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
omeka/plugin-SimplePages#49 ·
-
Bug Status: Needs Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
quantum-php/project#222 ·
-
support
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày