state/editing? outlives the editor's textarea
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Refactor
- Clarity
- Needs clarification
- Activity status
- Active
- Domain
- backend
Research direction
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.
Written by the indexing model from the issue text.
Description
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-collapsedgot 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.
- Dominant language
- No language data
- Stars
- 29
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from logseq/db-test
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Page titles with `$$`, `$&`, `` $` `` or `$'` change when block refs are resolvedPossibly taken @RaphaelFakhri claimed this 19 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
`#Asset` label is not displayed on asset nodes when `Hide from Node` is disabledPossibly taken @tiensonqin claimed this 22 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
WalletConnect/walletconnect-monorepo#7392 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
rohit746/pdf-view.nvim#109 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Azure/azure-functions-nodejs-extensions#180 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
tidyverse/ellmer#1226 · 1 comment ·
Maintainers usually reply within 3 days