Cannot update a component (HotReload) while rendering a different component (CSSMotion). To locate the bad setState() call inside CSSMotion, follow the stack trace as described in https://react.dev/link/setstate-in-render
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
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- react, typescript
- Lĩnh vực
- frontend
Hướng nghiên cứu
Bắt đầu bằng cách xác định mã nguồn tương ứng với node_modules/rc-motion/es/CSSMotion.js và tái hiện cảnh báo của React trong quá trình render. So sánh patch được báo cáo với mã nguồn của dự án và xác minh rằng cảnh báo không còn xảy ra; payload không nêu tên tệp kiểm thử, vì vậy hãy xác định các kiểm thử Motion hiện có liên quan trước khi thực hiện thay đổi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch [email protected] for the project I'm working on.
Here is the diff that solved my problem:
diff --git a/node_modules/rc-motion/es/CSSMotion.js b/node_modules/rc-motion/es/CSSMotion.js
index c75a051..364992e 100644
--- a/node_modules/rc-motion/es/CSSMotion.js
+++ b/node_modules/rc-motion/es/CSSMotion.js
@@ -56,6 +56,7 @@ export function genCSSMotion(config) {
return null;
}
}
+
var _useStatus = useStatus(supportMotion, visible, getDomElement, props),
_useStatus2 = _slicedToArray(_useStatus, 4),
status = _useStatus2[0],
@@ -120,14 +121,21 @@ export function genCSSMotion(config) {
// Auto inject ref if child node not have `ref` props
if ( /*#__PURE__*/React.isValidElement(motionChildren) && supportRef(motionChildren)) {
- var _ref = motionChildren,
- originNodeRef = _ref.ref;
- if (!originNodeRef) {
- motionChildren = /*#__PURE__*/React.cloneElement(motionChildren, {
- ref: setNodeRef
- });
- }
+ const originNodeRef = motionChildren.ref;
+
+ motionChildren = React.cloneElement(motionChildren, {
+ ref: (node) => {
+ // Assign the ref in a callback function to avoid modifying state during render
+ setNodeRef(node);
+ if (typeof originNodeRef === 'function') {
+ originNodeRef(node);
+ } else if (originNodeRef) {
+ originNodeRef.current = node;
+ }
+ },
+ });
}
+
return /*#__PURE__*/React.createElement(DomWrapper, {
ref: wrapperNodeRef
}, motionChildren);
This issue body was partially generated by patch-package.
- Ngôn ngữ chính
- TypeScript
- Star
- 179
- Fork
- 52
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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 react-component/motion
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
react-component/motion#68 · 1 bình luận ·
-
React 19 compatibleĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
react-component/motion#66 · 5 reaction ·
-
Tree-shakingĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
react-component/motion#45 ·
-
State not always up to dateĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
react-component/motion#36 · 1 bình luận · 1 reaction ·
-
Examples should use React 18 APIĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
react-component/motion#35 · 1 bình luận ·
Tất cả issue của react-component/motion
Issue tương tự
-
Upgrade node-libzim to 4.7.0Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
openzim/mwoffliner#2933 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Use the README category name for website links and submissionsCó thể đã có người làm @dajiaohuang đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
birobirobiro/awesome-shadcn-ui#647 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Add: Valea Prahovei TV RO SDĐang mởcheck:passed streams:add
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Urigo/accounter-fullstack#4604 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày