Selection toolbar paints stale condition results for one frame
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 静か
- 技術スタック
- react, typescript
- 領域
- frontend
調査の方向性
TextSelectionTooltip から始めてください。ここでは conditionKey が state に保存され、依存配列のない useEffect で更新されています。toolbarData は [config, conditionKey] でメモ化されています。calcConditionKey(config, editor, editorView) を使ってレンダー中にキーを計算し、state と effect を削除してください。その後、2つの段落がある WYSIWYG playground で選択ツールバーを確認してください。段落をまたいで選択を広げたときにブロックタイプの select が1フレーム表示されたままにならず、余分な再レンダーも発生しなければ完了です。
索引モデルが issue の本文から書いたものです。
説明
TextSelectionTooltip keeps conditionKey in state and refreshes it in a useEffect without a dependency list, so the key is recomputed after the render that consumed it. toolbarData is memoized on [config, conditionKey], so a render caused by a selection change reuses the cached value and paints the previous set of buttons. The effect then updates the key and a second render paints the correct one.
This shows up on any item with a condition. In the built-in presets those are the block type select and the folding heading button, visible only while the selection stays inside a single paragraph or heading.
Steps:
- Open the playground in WYSIWYG mode with two paragraphs.
- Select a word inside the first paragraph — the selection toolbar shows the block type select.
- Extend the selection into the second paragraph.
The block type select stays visible for one frame after its condition turns false, and every condition flip costs an extra render.
Computing the key during render instead of storing it removes both. Present since #1044.
const [conditionKey, setConditionKey] = useState(() => calcConditionKey(config, editor, editorView));
useEffect(() => {
const newKey = calcConditionKey(config, editor, editorView);
if (conditionKey !== newKey) setConditionKey(newKey);
});
- 主要言語
- TypeScript
- スター
- 428
- フォーク
- 48
- 平均マージ
- 5日 15時間
- マージ済み PR(30日)
- 47
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
gravity-ui/markdown-editor のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
gravity-ui/markdown-editor#1452 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
gravity-ui/markdown-editor#1129 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
gravity-ui/markdown-editor#1450 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
gravity-ui/markdown-editor#1331 ·
メンテナーはふだん 1 日以内に返信
-
Shared `slotsTokenizer` for directive blocks対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
gravity-ui/markdown-editor#1301 ·
メンテナーはふだん 1 日以内に返信
gravity-ui/markdown-editor の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
tintinweb/pi-subagents#459 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
danielmiessler/LifeOS#2830 ·
メンテナーはふだん 6 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
freshframework/fresh#3920 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
area: client enhancement priority: low
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
opensro-dev/opensro#3681 ·
メンテナーはふだん 1 日以内に返信