[Bug]: "Clear" / "Reload" button in CodeSandbox does not reset user edits to original sample code

Đang mở
#8,657 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
68/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
javascript, react
Lĩnh vực
documentation

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện hành vi reset trong phần "Treat state as read-only" của react.dev/learn/updating-objects-in-state, sau đó lần theo luồng reset của Interactive Code Sandbox. Được xem là hoàn tất khi Clear hoặc Reload khôi phục mã mẫu ban đầu và chấm đỏ không còn đi theo con trỏ.

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

Mô tả

bug: unconfirmed
Summary

Component: Interactive Code Sandbox

Steps to Reproduce:

  1. Navigate to the "Treat state as read-only" section in the React documentation.
  2. Modify the sample code inside the sandbox. Change:

position.x = e.clientX;
position.y = e.clientY;

to:

const p = { x: e.clientX, y: e.clientY };
setPosition(p);

3.Observe that the red dot starts following the cursor as expected.
4.Click the "Clear" or "Reload" button on the sandbox to undo the edits and restore the original code sample.

Expected Result:
The sandbox should revert to the original, unedited sample code (position.x = e.clientX), and the red dot should stop following the cursor.

Actual Result:
The red dot continues to follow the cursor despite triggering a reset.

Page

https://react.dev/learn/updating-objects-in-state

Details
Image
Ngôn ngữ chính
JavaScript
Star
11.8k
Fork
7.9k
Merge trung bình
16 giờ 6 phút
Pull request đã merge (30 ngày)
7

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

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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của reactjs/react.dev

Tất cả issue của reactjs/react.dev

Issue tương tự

Thêm issue về JavaScript

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.