Skip to content

ENG-1580 Fix command palette availability#939

Closed
trangdoan982 wants to merge 2 commits intomainfrom
worktree-eng-1580-template-not-applied-during-node-creation-from-command
Closed

ENG-1580 Fix command palette availability#939
trangdoan982 wants to merge 2 commits intomainfrom
worktree-eng-1580-template-not-applied-during-node-creation-from-command

Conversation

@trangdoan982
Copy link
Copy Markdown
Member

@trangdoan982 trangdoan982 commented Apr 3, 2026

Summary

  • Fix stale metadata cache: applyTemplate was reading target file's frontmatter from metadataCache before computing the merge, but newly created files may not be indexed yet — causing template frontmatter to overwrite nodeTypeId and other fields. Fixed by computing the merge inside processFrontMatter where the live fm object is available.
  • Fix command palette availability: create-discourse-node used editorCallback, which is only available when a markdown editor is active. Switched to callback so it's accessible from any view (canvas, graph, file explorer, etc.).
  • Simplify handler: createModifyNodeModalSubmitHandler now accepts editor?: Editor, eliminating the duplicate inline fallback handler.

Test plan

  • Open command palette from a canvas view — "Create discourse node" should appear and work
  • Open command palette from a markdown note — "Create discourse node" should work and insert [[link]] if creating from selected text
  • Create a new discourse node with a template assigned — template frontmatter and body should be applied correctly without overwriting nodeTypeId
  • Create a node via the open-node-type-menu command with a selection — template should still apply

🤖 Generated with Claude Code


Open with Devin

…alette

- Switch create-discourse-node command from editorCallback to callback so
  it's available from any view (canvas, graph, file explorer, etc.)
- Fix stale metadata cache race condition in applyTemplate: compute merged
  frontmatter inside processFrontMatter callback using live fm instead of
  potentially stale metadataCache for newly created files
- Simplify createModifyNodeModalSubmitHandler to accept optional editor,
  removing duplicate inline handler

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@linear
Copy link
Copy Markdown

linear bot commented Apr 3, 2026

@supabase
Copy link
Copy Markdown

supabase bot commented Apr 3, 2026

This pull request has been ignored for the connected project zytfjzqyijgagqxrzbmz because there are no changes detected in packages/database/supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

@trangdoan982 trangdoan982 changed the title ENG-1580 Fix template not applied during node creation from command palette ENG-1580 Fix command palette availability Apr 3, 2026
@trangdoan982
Copy link
Copy Markdown
Member Author

some work done here for consistent command behavior but I think we can table this until we finish consolidating all the create node flows from Obsidian

@trangdoan982 trangdoan982 deleted the worktree-eng-1580-template-not-applied-during-node-creation-from-command branch April 3, 2026 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant