-
Notifications
You must be signed in to change notification settings - Fork 1
feat(calendar): cache occurrences and notes within fetched range #340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Skip redundant API calls when navigating from a wider range (month) to a narrower one (week/day) by tracking the last fetched range and checking containment before fetching. occurrences are re-indexed in memory on cache hit; notes skip the fetch entirely. mutations invalidate the cache.
📝 WalkthroughWalkthroughThe PR introduces range-based caching for notes and occurrences. It updates the notes service to use ZonedDateTime with absolute string formatting, and modifies both notes and occurrences stores to track fetched date ranges and bypass API calls when requested ranges fall within cached data. Changes
Sequence Diagram(s)sequenceDiagram
participant Component
participant Store as Notes/Occurrences Store
participant Cache as Cached Range
participant Service as Notes/Occurrences Service
participant API as Backend API
rect rgba(173, 216, 230, 0.5)
note over Component,API: Cached Path
Component->>Store: fetchNotes/fetchOccurrences(range)
Store->>Cache: Check if range covered?
Cache-->>Store: Yes, cached
Store->>Store: Rebuild from existing state
Store-->>Component: Return cached data
end
rect rgba(255, 182, 193, 0.5)
note over Component,API: Cache Miss Path
Component->>Store: fetchNotes/fetchOccurrences(range)
Store->>Cache: Check if range covered?
Cache-->>Store: No, not cached
Store->>Service: listNotes/listOccurrences(zoned range)
Service->>API: Query with absolute date strings
API-->>Service: Return results
Service-->>Store: Results
Store->>Cache: Update notesFetchedRange/occurrencesFetchedRange
Store-->>Component: Return fresh data
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Tip 🧪 Unit Test Generation v2 is now available!We have significantly improved our unit test generation capabilities. To enable: Add this to your reviews:
finishing_touches:
unit_tests:
enabled: trueTry it out by using the Have feedback? Share your thoughts on our Discord thread! Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
#196 Bundle Size — 1.84MiB (+0.04%).47ea7b5(current) vs 1dbb671 main#195(baseline) Warning Bundle contains 2 duplicate packages – View duplicate packages Bundle metrics
Bundle size by type
Bundle analysis report Branch feat/cache-calendar-range-fetche... Project dashboard Generated by RelativeCI Documentation Report issue |
Skip redundant API calls when navigating from a wider range (month) to a narrower one (week/day) by tracking the last fetched range and checking containment before fetching. occurrences are re-indexed in memory on cache hit; notes skip the fetch entirely. mutations invalidate the cache.
Summary by CodeRabbit
Performance Improvements
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.