Skip to content

fix: refresh calendars when daily-note timeblocks change - #2496

Open
ac8318740 wants to merge 1 commit into
callumalpass:mainfrom
ac8318740:pr/2482-calendar-timeblock-refresh
Open

ac8318740 wants to merge 1 commit into
callumalpass:mainfrom
ac8318740:pr/2482-calendar-timeblock-refresh

Conversation

@ac8318740

Copy link
Copy Markdown
Contributor

Summary

The calendar now refreshes when a daily note's timeblocks change outside TaskNotes. Body-only edits don't trigger a refresh.

Closes #2482.

How it works

flowchart TB
  L[Calendar loads] --> S[Seed timeblock snapshots]:::changed
  M[Daily-note metadata changes] --> C{Timeblocks changed?}:::changed
  S -.-> C
  C -->|No| I[Ignore]:::changed
  C -->|Yes, timeblocks visible| D[Debounce 300 ms]:::changed
  D --> R[Refetch calendar events]
  classDef changed stroke-width:3px
Loading

Seeding the snapshots also prevents a refetch on the first body-only edit.

What changed

  • Listen for daily-note metadata changes outside the base's results
  • Compare timeblock values before scheduling a refetch
  • Cancel pending work when the view unloads
  • Add unit coverage and an isolated Obsidian regression test

Blast radius

Calendar refresh only. No changes to timeblock writes, pinning, Mini Calendar, settings, or stored data.

Test plan

  • Run npm run typecheck, npm run lint, and npm run build
  • Run npx jest --maxWorkers=2: 780 suites passed, 68 skipped; 5,969 tests passed, 988 skipped, 4 todo
  • Verify unchanged timeblocks, debounce, hidden views, and unload cleanup in unit tests
  • Reproduce stale timeblocks on upstream in isolated Obsidian 1.15.0, then verify outside edits and removals update without reopening on this branch

Compare cached timeblock values before debouncing a calendar refetch.
Seed the comparison when the view loads so body-only edits stay quiet.
Cover the listener lifecycle and outside edits in isolated Obsidian.

Refs callumalpass#2482.

(cherry picked from commit e5f8168)

This branch has not been deployed

No deployments
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.

Open calendar doesn't show timeblock changes made outside TaskNotes until refreshed

1 participant