feat(dashboard): optimal stale-while-revalidate cache for system stats#3033
Open
OlziYT wants to merge 2 commits into
Open
feat(dashboard): optimal stale-while-revalidate cache for system stats#3033OlziYT wants to merge 2 commits into
OlziYT wants to merge 2 commits into
Conversation
- Refactored store to use Svelte context API instead of a module-level singleton to prevent SSR data leakage. - Converted the internal cache map to a reactive \$state\ object to ensure proper updates inside effects/derived state.
Author
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.
This PR extracts the stale-while-revalidate cache from the bugfix PR #3024 into its own dedicated feature, using Svelte 5 store patterns to ensure state is safely encapsulated.
Changes
system-stats-cache.store.svelte.tswhich provides a clean API for caching system metrics with a configurable TTL (currently 5 minutes).dashboard-all-environments-view.svelteto read from and write to this store instead of a module-level variable.This provides the optimal UX by preventing skeleton flashes during menu navigation, while respecting SvelteKit architecture best practices.
Disclaimer Greptiles Reviews use AI, make sure to check over its work.
To better help train Greptile on our codebase, if the comment is useful and valid Like the comment, if its not helpful or invalid Dislike
To have Greptile Re-Review the changes, mention
greptileai.Greptile Summary
This PR adds stale-while-revalidate caching for dashboard system stats. The main changes are:
systemStatsCacheStorewith TTL-based cached stats.Confidence Score: 5/5
The changes are focused on dashboard stats caching and do not introduce identified merge-blocking concerns.
The reviewed changes are small, localized, and align with the stated cache behavior without identified correctness or security issues.
What T-Rex did
Reviews (2): Last reviewed commit: "fix(dashboard): address greptile code re..." | Re-trigger Greptile