Add caching mechanism for initial batch of rules by author#2477
Merged
Freego1783 merged 4 commits intomainfrom Feb 24, 2026
Merged
Add caching mechanism for initial batch of rules by author#2477Freego1783 merged 4 commits intomainfrom
Freego1783 merged 4 commits intomainfrom
Conversation
Member
Author
|
/deploy |
Contributor
PR Preview Deployed
This preview will be automatically deleted when the PR is closed. |
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request implements a caching mechanism for the first batch of rules fetched by author in the user profile page. The changes optimize performance by caching the initial 20 rules for each author with a 24-hour TTL and stale-while-revalidate strategy, while also adding a 100-rule limit on the client side to prevent excessive data fetching.
Changes:
- Add server-side caching for the first batch (20 rules) of author rules with 24-hour cache duration
- Implement Cache-Control headers with stale-while-revalidate for CDN/browser caching
- Add MAX_AUTHORED_RULES limit (100) on client to cap the total rules fetched per author
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| app/api/tina/rules-by-author/route.ts | Implements Next.js unstable_cache for first batch of author rules with conditional caching based on environment and request parameters |
| app/user/client-page.tsx | Adds MAX_AUTHORED_RULES constant and loop termination logic to limit authored rules fetching to 100 rules |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Freego1783
approved these changes
Feb 24, 2026
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.
#2468
This pull request introduces caching and pagination improvements to the "rules by author" API endpoint and applies a new limit to the number of authored rules fetched on the user client page. The main goal is to optimize performance by caching the first batch of results and to prevent excessive data fetching on the client side.