Skip to content

fix: show opened documents before their folder finishes scanning - #666

Merged
Azganoth merged 1 commit into
mainfrom
bug/launch-document-open
Oct 10, 2026
Merged

Azganoth merged 1 commit into
mainfrom
bug/launch-document-open

Conversation

@Azganoth

Copy link
Copy Markdown
Owner

Summary

Opening a file waited for a full recursive scan of its parent folder before showing anything, while the window already showed the welcome screen. In a large folder the document looked as if it had not opened. The installed 0.1.0-alpha.2 diagnostic log shows this is what happened behind #656. File Explorer launches into Documents (about 12,000 files in 2,000 directories) waited around 10 s on the folder scan; one was logged at 10,053 ms. The windows reported as empty were closed 2–6 s after starting, before their scan finished. No logged launch lost its path or failed to open.

  • Open File shows the document as soon as it is read, from every entry point. When no folder context is active, the session records the parent folder as loading and scans it in the background. Until the scan finishes, the article navigator shows skeleton rows under the folder's name.
  • A loading folder counts as the folder context, so a later file open or Save As keeps it. Opening a folder replaces it. Backend scans cannot be cancelled, so a superseded scan's result is discarded by load ID when it arrives.
  • The editor, HTML export, and default save locations get the loading folder's path. Images outside the folder therefore need the same confirmation before and after the scan finishes.
  • Commands that need the article tree stay disabled while the folder loads; Toggle sidebar stays available.
  • If the folder scan fails, the document stays open and the folder scan error is shown. Previously the readable document was discarded with a generic open error. The parent folder is added to recent folders only after its scan succeeds.

Related Issue

Closes #656

Verification

  • openSession tests cover four cases: the document showing before the scan resolves, a second open during loading keeping the folder, an opened folder replacing a load, and a failed scan keeping the document while showing the scan error. The replacement case fails when the stale-load check is removed.
  • An App test delays preference loading and launches a path containing spaces and Unicode. It confirms the launch path is read only after startup finishes, the document opens while the scan is pending with the skeleton shown, and the folder context arrives afterward.
  • documentWorkflows and command-state tests cover Save As keeping a loading folder, and which commands are available while a folder loads.
  • pnpm check:frontend passed.

Not verified: File Explorer launches with an installed build of this branch, from a cold start or with another Leafdown window open. The launch-document desktop scenario is unchanged; it already launches a Unicode path containing spaces and checks the folder tree and recents, and was not run locally. The skeleton's appearance was not checked visually.

Notes

  • Open Folder still waits for its scan with no loading state, and Save As in a session without a folder still scans before updating the document. Both share the large-folder cost but were outside File Explorer launches sometimes leave the requested document unopened #656.
  • One installed launch spent about 8.6 s before its scan started. The log does not show where that time went, and this change does not address it.

@Azganoth Azganoth added the Bug Something isn't working label Oct 10, 2026
@Azganoth Azganoth self-assigned this Oct 10, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in Leafdown Oct 10, 2026
@Azganoth
Azganoth merged commit 4804c81 into main Oct 10, 2026
3 checks passed
@Azganoth
Azganoth deleted the bug/launch-document-open branch October 10, 2026 14:39
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Leafdown Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

File Explorer launches sometimes leave the requested document unopened

1 participant