An edit is lost when the page reloads right after Escape
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- sqlite
- Domain
- database
Research direction
Start by tracing the editor save path through the async steps that build outliner ops and post apply-outliner-ops, then inspect how the worker acknowledges the sqlite transaction. Reproduce with the described Escape and reload timings; done means an edit survives reload during the reported window. The issue lists several possible designs and leaves the choice to maintainers.
Written by the indexing model from the issue text.
Description
An edit is lost when the page reloads right after Escape
Type in a block, press Escape, and reload within about 150 ms: the edit is gone after the reload (no block in the database holds it). At 500 ms it is kept. On an idle machine the window is short; on a loaded one it is wide enough to hit by hand.
Found by a local key fuzzer that types a unique token into the focused block editor, presses Escape twice, waits 0, 150 or 500 ms, reloads, and then queries the database for the token (logseq.api.datascript_query): 7 of 118 such checks lost the token, all at 0 or 150 ms, none at 500 ms, with varied preceding steps. A fresh page on an idle machine kept the edit 24 of 24 times.
Where the edit is lost
The worker writes a transaction to sqlite synchronously once it has it, so the loss is between Escape and the save reaching the worker: the save builds its outliner ops through several async steps before apply-outliner-ops posts them, and a reload in that time drops them. Nothing in the web app holds or flushes a pending save on unload: there is no beforeunload or pagehide handler for it.
Possible directions
- On
pagehide, post whatever the editor still holds synchronously (the save would need a synchronous path for that). - While a save is in flight, set a
beforeunloadhandler so the browser asks before leaving (and the desktop app waits for it before closing the window). - Keep the editor's content somewhere that survives the reload (session storage) until the worker has acknowledged the save, and replay it on start.
Each changes how saving works, so this 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
-
Web build on a phone: the fold arrow of an h1/h2 block lies on its bullet, so tapping the bullet folds instead of zooming inPossibly taken @tiensonqin claimed this 2 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 87/100
-
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
Similar issues
-
Add: Hindi Hits LogoOpencheck:passed logos:add
Difficulty 1/5 Under an hour Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
backend prio:low
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
digitalfabrik/entitlementcard#3262 ·
Maintainers usually reply within 2 days
-
bot-found bug priority: P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
madenvel/KalinkaPlayer#536 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
RedisStorage writes can persist a key without its sliding TTLPossibly taken @lianbie claimed this today. Opentriage/confirmed
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
agentscope-ai/agentscope#3878 · 1 comment ·
Maintainers usually reply within 2 days