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

オープン
#8,657 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

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

調査の方向性

まず react.dev/learn/updating-objects-in-state の "Treat state as read-only" セクションでリセット動作を再現し、次に Interactive Code Sandbox のリセットフローを追跡します。Clear または Reload で元のサンプルコードが復元され、赤い点がカーソルを追わなくなれば完了です。

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

説明

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
主要言語
JavaScript
スター
11.8k
フォーク
7.9k
平均マージ
16時間 6分
マージ済み PR(30日)
7

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

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

はじめの一歩

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

reactjs/react.dev のほかの issue

reactjs/react.dev の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

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

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