Fix file-properties cachedFile race crash on file switch #154
Labels
No labels
abandoned
active
audit
blocked
data-safety
difficulty:easy
difficulty:hard
difficulty:high
difficulty:medium
docs
done
duplicate
notebook-v0
open
priority:high
ready
release-critical
safe-mode
spec
spec-backlog
subsystem:api
subsystem:backlog
subsystem:bases
subsystem:ci
subsystem:command
subsystem:configuration
subsystem:consolidate
subsystem:dependencies
subsystem:desktop-electron
subsystem:diffmerge
subsystem:docker
subsystem:docs
subsystem:fuzzy
subsystem:graph
subsystem:hotkeys
subsystem:lapis
subsystem:maint
subsystem:maintenance
subsystem:markdown
subsystem:markdown-lint
subsystem:md018
subsystem:notebook
subsystem:notifications
subsystem:opfs
subsystem:package
subsystem:plugin-markdown
subsystem:plugin-tasks
subsystem:plugins
subsystem:registry
subsystem:release
subsystem:renovate
subsystem:restore
subsystem:scripts
subsystem:search
subsystem:settings
subsystem:spec
subsystem:tasks
subsystem:testing
subsystem:ui
subsystem:web
subsystem:workspace
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lapis-notes/lapis#154
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The file properties side panel throws when switching notes quickly because an async
callback reads
cachedFile.hashafter the active file has changed.Problem
file-properties.svelteguards oncachedFile?.hashsynchronously, then readscachedFile.hashinsidetick().then(() => setTimeout(...)). When the userswitches files before the callback runs,
cachedFileis undefined and the panelcrashes with
Cannot read properties of undefined (reading 'hash').Goal
Load frontmatter synchronously from the metadata cache without async races.
Scope
$effectwith$derived.byusingapp.metadataCache.getCache(path)cachedFile,tick, and mutable$statefor frontmatterNon-goals
Acceptance Criteria
pnpm --filter @lapis-notes/plugin-markdown check:allpassesImplementation Notes
Use the same cache lookup API as
outline.svelte(getCache(path)).Suggested Files or Specs To Inspect
packages/plugins/plugin-markdown/src/lib/views/file-properties/file-properties.sveltepackages/plugins/plugin-markdown/src/lib/views/outline/outline.svelteValidation Commands
Related Issues
Follow-up Tasks
Implementation Summary
Replaced async cachedFile hash lookup in file-properties.svelte with synchronous $derived.by using metadataCache.getCache(path). Eliminates race when switching files while the panel is open. Validated with pnpm --filter @lapis-notes/markdown check:all and check:svelte.