Open
Remove non-null assertions, fix cache validation message logic, and merge main branch#11
Conversation
…ecking This commit refactors the data fetching and caching logic to follow true local-first principles: **Changes:** 1. **Cache Freshness Utilities** (src/utils/indexedDB.ts): - Added CACHE_TTL_MS constant (30 minutes default) - Implemented cacheUtils.isFresh() to check cache age - Implemented cacheUtils.matchesQuery() to validate cache against current query - Implemented cacheUtils.isValidCache() to combine both checks 2. **Local-First Data Fetching** (src/hooks/useGitHubDataFetching.ts): - Added eventsMetadata and searchItemsMetadata parameters - Check cache freshness BEFORE deciding to block UI - If cache is fresh and matches query: non-blocking background refresh - If cache is stale or missing: blocking initial load - Users see cached data immediately when available - API fetches happen in background without locking the UI 3. **Updated App Integration** (src/App.tsx): - Destructure metadata from useIndexedDBStorage hooks - Pass metadata to useGitHubDataFetching for cache validation **Before:** API-first with local caching (always blocks UI to fetch) **After:** Local-first with background sync (shows cache, refreshes behind scenes) **Benefits:** - Instant data display when cache is fresh (< 30 min old) - No UI blocking for background refreshes - Better offline experience - Clearer data flow that's easier to reason about - True local-first architecture as documented All tests pass. No breaking changes to existing functionality.
- Remove non-null assertion operators by using proper conditional checks - Check cache query match before showing "Cache outdated" message - Validate cache matches query parameters before displaying status Co-authored-by: kertal <463851+kertal@users.noreply.github.com>
Deploying git-vegas with
|
| Latest commit: |
861b858
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://fe206960.git-vegas.pages.dev |
| Branch Preview URL: | https://copilot-sub-pr-10.git-vegas.pages.dev |
- Remove !! operator as it's unnecessary with logical AND - Use consistent ternary pattern for cache query matching - Eliminate redundant null checks while maintaining type safety Co-authored-by: kertal <463851+kertal@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement local-first architecture with IndexDB
Remove non-null assertions and fix cache validation message logic
Jan 1, 2026
kertal
approved these changes
Jan 8, 2026
kertal
marked this pull request as ready for review
January 8, 2026 05:48
kertal
force-pushed
the
claude/local-first-indexdb-0zENV
branch
from
January 9, 2026 22:43
04c2dfc to
806ef15
Compare
Owner
|
@copilot resolve conflicts |
- Keep both cacheUtils (from this branch) and prCacheStorage (from main) - Both utilities can coexist as separate exports - All tests pass after merge Co-authored-by: kertal <463851+kertal@users.noreply.github.com>
Contributor
Author
Conflicts resolved in commit 861b858. The conflict in |
Copilot
AI
changed the title
Remove non-null assertions and fix cache validation message logic
Remove non-null assertions, fix cache validation message logic, and merge main branch
Jan 11, 2026
Owner
|
@claude fix conflicts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses two TypeScript safety and UX issues in the local-first cache validation logic, and resolves merge conflicts with the main branch:
Remove non-null assertion operators
metadata!with ternary pattern:metadata ? cacheUtils.isValidCache(metadata, ...) : false!!operators in boolean contexts where unnecessaryFix cache status message logic
Merge main branch and resolve conflicts
src/utils/indexedDB.tsby keeping both exports:cacheUtils: Cache validation utilities for local-first architecture (from this branch)prCacheStorage: PR cache storage utilities (from main branch)💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.