Skip to content

fix: populate query context during on_save hooks#168

Merged
careck merged 1 commit intomasterfrom
fix/on-save-query-context
Apr 28, 2026
Merged

fix: populate query context during on_save hooks#168
careck merged 1 commit intomasterfrom
fix/on-save-query-context

Conversation

@careck
Copy link
Copy Markdown
Member

@careck careck commented Apr 28, 2026

Summary

  • on_save hooks had no query context, so get_note() calls returned unit
  • Hooks that resolve linked notes (e.g. Activity deriving its title from a linked Location/Transport/Stay) always fell through to fallback titles like "Untitled Activity"
  • Now build_query_context() runs before the hook and clears after, matching the pattern used by view/hover hooks

Test plan

  • All 628 core tests pass
  • Create an Activity with a linked Location, save it, verify the title resolves to "09:00 — Location Name" instead of "Untitled Activity"

on_save hooks had no query context, so get_note() calls to resolve
linked notes returned unit. This meant hooks like Activity's
title derivation (which resolves Location/Transport/Stay names)
always fell through to "Untitled Activity".

Now build_query_context() runs before the hook and clears after,
matching the pattern used by view/hover hooks.
@careck careck merged commit 24e8105 into master Apr 28, 2026
2 checks passed
@careck careck deleted the fix/on-save-query-context branch April 29, 2026 06:46
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