state/editing? outlives the editor's textarea

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

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

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
リファクタリング
明瞭さ
説明が足りない
活発さ
活発
領域
backend

調査の方向性

Read the :editor/editing? state and state/get-input callers, then trace the editor component lifecycle and the shortcut and CodeMirror paths described in the issue. Compare the two proposed meanings of editing? and identify which callers need each; done means maintainers have chosen a consistent state contract that prevents stale textarea access.

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

説明

state/editing? outlives the editor's textarea

state/editing? (:editor/editing?) can stay true for a moment after the block editor's textarea has left the DOM: the block was just deleted, the editor closed, a re-render replaced it. In that window state/get-input returns nil while everything that asks editing? still treats the user as editing. Code that trusts editing? and then reads the textarea throws.

A local key fuzzer that records uncaught page errors found this through several entry points:

  • block-editing shortcuts (Alt+E, Alt+A, Alt+U, Alt+K, the word movement and word delete shortcuts): fixed for the whole shortcut group in #13865 by requiring a live input in the group's gate;
  • Up/Down at the edge of a code block (CodeMirror's own key handler, outside the shortcut gate): get-prev-block-non-collapsed got a nil block (also in #13865);
  • earlier, cursor helpers and paste handlers reached through other paths.

#13865 removes the crashes but leaves the state as it is: any new code that checks editing? and reads the textarea can hit the same thing.

The design question

Should editing? mean "a block editor textarea is mounted"? Options:

  • clear :editor/editing? when the editor component that set it unmounts without another taking over (care is needed for re-renders that unmount and remount the same editor);
  • or define editing? as (some? (get-input)) for callers that act on the textarea, and keep the current flag for callers that only need "a block is being edited".

This touches editing state everywhere, so it is a question for the maintainers rather than a patch.

主要言語
言語のデータがありません
スター
29
フォーク
2
PR マージ指標
30日以内にマージされた PR はありません

環境構築

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

はじめの一歩

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

logseq/db-test のほかの issue

logseq/db-test の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

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

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