Web UI: picking a config from the loader discards unsaved editor edits without confirmation

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

メンテナーはふだん 1 日以内に返信

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python, react, typescript
領域
frontend

調査の方向性

Start with the reload effect in src/profiles/web/src/components/ConfigEditorModal.tsx and the loader callback in src/profiles/web/src/App.tsx. Trace how isDirty, pendingAction, and the existing ConfirmDialog handle destructive actions, then check how edits made during the fetch are detected. Done means a dirty buffer is preserved until the user chooses whether to adopt the fetched config or keep editing.

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

説明

bug frontend

Problem

The editor's load effect replaces the document whenever reloadKey changes — with no dirty check:

// src/profiles/web/src/components/ConfigEditorModal.tsx:328-376
useEffect(() => { … fetchConfigContent().then((data) => {
  … loadedTextRef.current = content;
  setLoad({ status: "ready", data: { ...data, content } });
}) … }, [open, reloadKey]);

And App bumps it unconditionally after a pick in the loader:

// src/profiles/web/src/App.tsx:1602-1605
onLoaded={(cfg) => { void handleConfigLoaded(cfg); setEditorReloadKey((key) => key + 1); }}

Every other destructive path (Escape / ✕ / New / Revert) is guarded by requestClose / pendingAction confirmations — this one is the gap beyond #116: with a dirty buffer, clicking "Load config file…" (raised from inside the editor since #101) loses all edits in one click. Edits typed during the fetch window are lost the same way.

Suggested fix

In the effect, before replacing, check isDirty(editorViewRef.current, loadedTextRef.current); when dirty, park the fetched content behind the existing pendingAction-style ConfirmDialog ("Adopt new config / keep editing") instead of swapping load.

主要言語
Python
スター
1
フォーク
1
平均マージ
4時間 46分
マージ済み PR(30日)
55

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

falbany/ProFiles のほかの issue

falbany/ProFiles の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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